Class: RoadForest::Authorization::AuthenticationChain::Basic

Inherits:
Scheme
  • Object
show all
Defined in:
lib/roadforest/authorization.rb

Instance Method Summary collapse

Methods inherited from Scheme

register, registry_purpose

Methods included from Utility::ClassRegistry::Registrar

extended, #get, #register, #registry

Instance Method Details

#authenticated_entity(credentials, store) ⇒ Object



121
122
123
124
125
126
127
# File 'lib/roadforest/authorization.rb', line 121

def authenticated_entity(credentials, store)
  username, password = Base64.decode64(credentials).split(':',2)

  entity = store.by_username(username)
  entity.authenticate_by_password(password)
  entity
end

#challenge(options) ⇒ Object



117
118
119
# File 'lib/roadforest/authorization.rb', line 117

def challenge(options)
  "Basic realm=\"#{options.fetch(:realm, "Roadforest App")}\""
end