Class: Devise::Strategies::TokenAuthenticatable

Inherits:
Authenticatable
  • Object
show all
Defined in:
lib/devise_token_authenticatable/strategies/token_authenticatable.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#last_request_atObject

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_idObject

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

Returns:

  • (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

Returns:

  • (Boolean)


21
22
23
# File 'lib/devise_token_authenticatable/strategies/token_authenticatable.rb', line 21

def valid?
  valid_for_http_auth?
end