Class: TokenAuthenticatableStrategies::Insecure

Inherits:
Base
  • Object
show all
Defined in:
app/models/concerns/token_authenticatable_strategies/insecure.rb

Instance Attribute Summary

Attributes inherited from Base

#klass, #options, #token_field

Instance Method Summary collapse

Methods inherited from Base

#ensure_token, #ensure_token!, fabricate, #initialize, #reset_token!

Constructor Details

This class inherits a constructor from TokenAuthenticatableStrategies::Base

Instance Method Details

#find_token_authenticatable(token, unscoped = false) ⇒ Object


5
6
7
# File 'app/models/concerns/token_authenticatable_strategies/insecure.rb', line 5

def find_token_authenticatable(token, unscoped = false)
  relation(unscoped).find_by(@token_field => token) if token
end

#get_token(instance) ⇒ Object


9
10
11
# File 'app/models/concerns/token_authenticatable_strategies/insecure.rb', line 9

def get_token(instance)
  instance.read_attribute(@token_field)
end

#set_token(instance, token) ⇒ Object


13
14
15
# File 'app/models/concerns/token_authenticatable_strategies/insecure.rb', line 13

def set_token(instance, token)
  instance[@token_field] = token if token
end