Class: Warden::OAuth2::Strategies::Token
- Defined in:
- lib/warden/oauth2/strategies/token.rb
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #authenticate! ⇒ Object
- #error_status ⇒ Object
- #token ⇒ Object
- #token_string ⇒ Object
- #valid? ⇒ Boolean
Methods inherited from Base
Instance Method Details
#authenticate! ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/warden/oauth2/strategies/token.rb', line 11 def authenticate! if token fail! 'invalid_token' and return if token.respond_to?(:expired?) && token.expired? fail! 'invalid_scope' and return if scope && token.respond_to?(:scope?) && !token.scope?(scope) success! token else fail! 'invalid_token' and return unless token end end |
#error_status ⇒ Object
29 30 31 32 33 34 35 36 |
# File 'lib/warden/oauth2/strategies/token.rb', line 29 def error_status case when 'invalid_token', 'token_required' then 401 when 'invalid_scope' then 403 when 'invalid_request' then 400 else 400 end end |
#token ⇒ Object
21 22 23 |
# File 'lib/warden/oauth2/strategies/token.rb', line 21 def token Warden::OAuth2.config.token_model.locate(token_string) end |
#token_string ⇒ Object
25 26 27 |
# File 'lib/warden/oauth2/strategies/token.rb', line 25 def token_string raise NotImplementedError end |
#valid? ⇒ Boolean
7 8 9 |
# File 'lib/warden/oauth2/strategies/token.rb', line 7 def valid? !!token_string end |