Class: Devise::Strategies::TokenAuthenticatable
- Inherits:
-
Authenticatable
- Object
- Authenticatable
- Devise::Strategies::TokenAuthenticatable
- Defined in:
- lib/devise_token_authenticatable/strategies/token_authenticatable.rb
Instance Attribute Summary collapse
-
#last_request_at ⇒ Object
Returns the value of attribute last_request_at.
-
#user_id ⇒ Object
Returns the value of attribute user_id.
Instance Method Summary collapse
Instance Attribute Details
#last_request_at ⇒ Object
Returns the value of attribute last_request_at.
7 8 9 |
# File 'lib/devise_token_authenticatable/strategies/token_authenticatable.rb', line 7 def last_request_at @last_request_at end |
#user_id ⇒ Object
Returns the value of attribute user_id.
7 8 9 |
# File 'lib/devise_token_authenticatable/strategies/token_authenticatable.rb', line 7 def user_id @user_id end |
Instance Method Details
#authenticate! ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/devise_token_authenticatable/strategies/token_authenticatable.rb', line 9 def authenticate! env['devise.skip_trackable'] = true resource = user_id.present? && mapping.to.find_for_database_authentication(authentication_hash) if validate(resource) { !resource.respond_to?(:timedout?) || !resource.timedout?(last_request_at) } success!(resource) end fail(:timeout) unless resource end |
#store? ⇒ Boolean
25 26 27 |
# File 'lib/devise_token_authenticatable/strategies/token_authenticatable.rb', line 25 def store? super && !mapping.to.skip_session_storage.include?(authentication_type) end |
#valid? ⇒ Boolean
21 22 23 |
# File 'lib/devise_token_authenticatable/strategies/token_authenticatable.rb', line 21 def valid? valid_for_http_auth? end |