Class: Resourceful::AuthenticationManager
- Defined in:
- lib/resourceful/authentication_manager.rb
Instance Method Summary collapse
- #add_auth_handler(authenticator) ⇒ Object
- #add_credentials(request) ⇒ Object
- #associate_auth_info(challenge) ⇒ Object
-
#initialize ⇒ AuthenticationManager
constructor
A new instance of AuthenticationManager.
Constructor Details
#initialize ⇒ AuthenticationManager
Returns a new instance of AuthenticationManager.
8 9 10 |
# File 'lib/resourceful/authentication_manager.rb', line 8 def initialize @authenticators = [] end |
Instance Method Details
#add_auth_handler(authenticator) ⇒ Object
12 13 14 |
# File 'lib/resourceful/authentication_manager.rb', line 12 def add_auth_handler(authenticator) @authenticators << authenticator end |
#add_credentials(request) ⇒ Object
22 23 24 25 26 |
# File 'lib/resourceful/authentication_manager.rb', line 22 def add_credentials(request) @authenticators.each do |authenticator| authenticator.add_credentials_to(request) if authenticator.can_handle?(request) end end |
#associate_auth_info(challenge) ⇒ Object
16 17 18 19 20 |
# File 'lib/resourceful/authentication_manager.rb', line 16 def associate_auth_info(challenge) @authenticators.each do |authenticator| authenticator.update_credentials(challenge) if authenticator.valid_for?(challenge) end end |