Class: Hadley::Authz::Bearer::Strategy

Inherits:
Strategy
  • Object
show all
Defined in:
lib/hadley/authz/bearer.rb

Instance Method Summary collapse

Methods inherited from Strategy

#config

Methods included from StrategyBuilder

#build

Instance Method Details

#authObject



25
26
27
# File 'lib/hadley/authz/bearer.rb', line 25

def auth
  @auth ||= Rack::Auth::Bearer::Request.new(env)
end

#authenticate!(anonymous_allowed = false) ⇒ Object



33
34
35
36
37
38
# File 'lib/hadley/authz/bearer.rb', line 33

def authenticate!(anonymous_allowed=false)
  return unauthorized unless auth.provided? and auth.bearer? and auth.token
  user = config.token_store.get(auth.token)
  return unauthorized unless user and (!user[:anonymous] or config.anonymous_allowed)
  success!(user)
end

#store?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/hadley/authz/bearer.rb', line 29

def store?
  false
end