Class: Resourceful::AuthenticationManager

Inherits:
Object
  • Object
show all
Defined in:
lib/resourceful/authentication_manager.rb

Instance Method Summary collapse

Constructor Details

#initializeAuthenticationManager

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