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

#current_sign_in_atObject

Returns the value of attribute current_sign_in_at.



7
8
9
# File 'lib/devise_token_authenticatable/strategies/token_authenticatable.rb', line 7

def 
  @current_sign_in_at
end

#current_sign_in_ipObject

Returns the value of attribute current_sign_in_ip.



7
8
9
# File 'lib/devise_token_authenticatable/strategies/token_authenticatable.rb', line 7

def 
  @current_sign_in_ip
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
20
21
# 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)

  return fail(:timeout) if resource.respond_to?(:timedout?) && !env['devise.skip_timeout'] && resource.timedout?()

  if validate(resource) { !resource.respond_to?(:current_sign_in_ip) || request.remote_ip ==  }
    success!(resource)
  end

  fail(:timeout) unless resource
end

#store?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/devise_token_authenticatable/strategies/token_authenticatable.rb', line 27

def store?
  super && !mapping.to.skip_session_storage.include?(authentication_type)
end

#valid?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/devise_token_authenticatable/strategies/token_authenticatable.rb', line 23

def valid?
  valid_for_http_auth?
end