Class: Devise::Strategies::Oauth2Providable
- Inherits:
-
Authenticatable
- Object
- Authenticatable
- Devise::Strategies::Oauth2Providable
- Defined in:
- lib/devise/oauth2_providable/strategies/oauth2_providable_strategy.rb
Instance Method Summary collapse
Instance Method Details
#authenticate! ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/devise/oauth2_providable/strategies/oauth2_providable_strategy.rb', line 10 def authenticate! @req.setup! token = Devise::Oauth2Providable::AccessToken.find_by_token @req.access_token env[Devise::Oauth2Providable::CLIENT_ENV_REF] = token.client if token resource = token ? token.user : nil if validate(resource) success! resource else fail(:invalid_token) end end |
#valid? ⇒ Boolean
6 7 8 9 |
# File 'lib/devise/oauth2_providable/strategies/oauth2_providable_strategy.rb', line 6 def valid? @req = Rack::OAuth2::Server::Resource::Bearer::Request.new(env) @req.oauth2? end |