Class: Devise::Strategies::Oauth2TokenBearerAuthenticatable
- Inherits:
-
Base
- Object
- Base
- Devise::Strategies::Oauth2TokenBearerAuthenticatable
- Defined in:
- lib/devise_oauth2_token_bearer_authenticatable/strategy.rb
Instance Method Summary collapse
Instance Method Details
#authenticate! ⇒ Object
9 10 11 12 13 14 |
# File 'lib/devise_oauth2_token_bearer_authenticatable/strategy.rb', line 9 def authenticate! token = AccessToken.valid.find_by_token env[Rack::OAuth2::Server::Resource::ACCESS_TOKEN] raise Rack::OAuth2::Server::Resource::Bearer::Unauthorized unless token raise Rack::OAuth2::Server::Resource::Bearer::Unauthorized.new(:invalid_token, 'User token is required') unless token.user success! token.user end |
#valid? ⇒ Boolean
6 7 8 |
# File 'lib/devise_oauth2_token_bearer_authenticatable/strategy.rb', line 6 def valid? env[Rack::OAuth2::Server::Resource::ACCESS_TOKEN].present? end |