Class: Hadley::Authz::Basic::Strategy
- Defined in:
- lib/hadley/authz/basic.rb
Overview
This class is the prototype class for all HTTP Basic authorization strategies used by hadley.
Instance Method Summary collapse
-
#auth ⇒ Rack::Aauth::Basic::Request
Provides access to the HTTP Basic Auth information assiciated with the current request.
-
#authenticate! ⇒ Object
Authenticates the entity identified by the provided HTTP Basic Auth information.
-
#store? ⇒ Boolean
Identifies whether a login using this strategy should be persisted across multiple requests.
Methods inherited from Strategy
Methods included from StrategyBuilder
#build, #create_strategy, #register_strategy, #set_config
Instance Method Details
#auth ⇒ Rack::Aauth::Basic::Request
Provides access to the HTTP Basic Auth information assiciated with the current request.
10 11 12 |
# File 'lib/hadley/authz/basic.rb', line 10 def auth @auth ||= Rack::Auth::Basic::Request.new(env) end |
#authenticate! ⇒ Object
Authenticates the entity identified by the provided HTTP Basic Auth information
24 25 26 27 28 29 30 31 |
# File 'lib/hadley/authz/basic.rb', line 24 def authenticate! return unless auth.provided? and auth.basic? and auth.credentials credentials = auth.credentials.map do |credential| config.hash_credentials ? Digest::SHA2.new(256).update(credential).to_s : credential end user = config.lookup.call(credentials.first, credentials.last) return user ? success!(auth.credentials.first) : end |
#store? ⇒ Boolean
Identifies whether a login using this strategy should be persisted across multiple requests.
19 20 21 |
# File 'lib/hadley/authz/basic.rb', line 19 def store? false end |