Class: Devise::Strategies::TokenAuthenticatable

Inherits:
Base
  • Object
show all
Defined in:
lib/metova/devise/strategies/token_authenticatable.rb

Instance Method Summary collapse

Instance Method Details

#authenticate!Object



7
8
9
10
11
12
13
14
# File 'lib/metova/devise/strategies/token_authenticatable.rb', line 7

def authenticate!
  user = mapping.to.find_by id: options[:id]
  if user && valid_token?(user)
    success! user
  else
    fail! 'Invalid authentication token'
  end
end

#valid?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/metova/devise/strategies/token_authenticatable.rb', line 16

def valid?
  token.present? && options.include?(:id)
end