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

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

Instance Method Summary collapse

Methods inherited from Scheme

register, registry_purpose

Methods included from Utility::ClassRegistry::Registrar

#all_names, extended, #get, #map_classes, #register, #registry

Instance Method Details

#authenticated_entity(credentials, store) ⇒ Object



26
27
28
29
30
31
32
# File 'lib/roadforest/authorization/authentication-chain.rb', line 26

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



22
23
24
# File 'lib/roadforest/authorization/authentication-chain.rb', line 22

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