Class: Hadley::Authz::Bearer::Strategy
- Inherits:
-
Strategy
- Object
- Warden::Strategies::Base
- Strategy
- Hadley::Authz::Bearer::Strategy
- Defined in:
- lib/hadley/authz/bearer.rb
Instance Method Summary collapse
-
#auth ⇒ Rack::Aauth::Bearer::Request
Provides access to the bearer token based auth information assiciated with the current request.
-
#authenticate!(anonymous_allowed = false) ⇒ Object
Authenticates the entity identified by the provided bearer token.
-
#store? ⇒ Boolean
Identifies whether a login using this strategy should be persisted across multiple requests.
Methods inherited from Strategy
Methods included from StrategyBuilder
#build, #create_strategy, #register_strategy, #set_config
Instance Method Details
#auth ⇒ Rack::Aauth::Bearer::Request
Provides access to the bearer token based auth information assiciated with the current request.
34 35 36 |
# File 'lib/hadley/authz/bearer.rb', line 34 def auth @auth ||= Rack::Auth::Bearer::Request.new(env) end |
#authenticate!(anonymous_allowed = false) ⇒ Object
Authenticates the entity identified by the provided bearer token.
48 49 50 51 52 53 |
# File 'lib/hadley/authz/bearer.rb', line 48 def authenticate!(anonymous_allowed=false) return unless auth.provided? and auth.bearer? and auth.token user = config.token_store.get(auth.token) return unless user and (!user[:anonymous] or config.anonymous_allowed) success!(user) end |
#store? ⇒ Boolean
Identifies whether a login using this strategy should be persisted across multiple requests.
43 44 45 |
# File 'lib/hadley/authz/bearer.rb', line 43 def store? false end |