Class: RoadForest::Authorization::AuthenticationChain
- Inherits:
-
Object
- Object
- RoadForest::Authorization::AuthenticationChain
- Defined in:
- lib/roadforest/authorization.rb
Defined Under Namespace
Instance Attribute Summary collapse
-
#store ⇒ Object
readonly
Returns the value of attribute store.
Instance Method Summary collapse
- #add_account(user, password, token) ⇒ Object
- #authenticate(header) ⇒ Object
- #challenge(options) ⇒ Object
- #handler_for(scheme) ⇒ Object
-
#initialize(store) ⇒ AuthenticationChain
constructor
A new instance of AuthenticationChain.
Constructor Details
#initialize(store) ⇒ AuthenticationChain
Returns a new instance of AuthenticationChain.
130 131 132 |
# File 'lib/roadforest/authorization.rb', line 130 def initialize(store) @store = store end |
Instance Attribute Details
#store ⇒ Object (readonly)
Returns the value of attribute store.
133 134 135 |
# File 'lib/roadforest/authorization.rb', line 133 def store @store end |
Instance Method Details
#add_account(user, password, token) ⇒ Object
147 148 149 |
# File 'lib/roadforest/authorization.rb', line 147 def add_account(user,password,token) @store.add_account(user,password,token) end |
#authenticate(header) ⇒ Object
151 152 153 154 155 156 157 158 159 160 161 162 |
# File 'lib/roadforest/authorization.rb', line 151 def authenticate(header) return nil if header.nil? scheme, credentials = header.split(/\s+/, 2) handler = handler_for(scheme) return nil if handler.nil? entity = handler.authenticated_entity(credentials, store) return nil if entity.nil? return nil unless entity.authenticated? return entity end |