Class: Authn::TokenField::Digest
- Inherits:
-
Base
- Object
- Base
- Authn::TokenField::Digest
show all
- Defined in:
- lib/authn/token_field/digest.rb
Constant Summary
Constants inherited
from Base
Base::TRUE_PROC
Instance Attribute Summary
Attributes inherited from Base
#expires_at_field, #klass, #options, #token_field
Instance Method Summary
collapse
Methods inherited from Base
#ensure_token, #ensure_token!, #expirable?, #expired?, #expires_at, fabricate, #initialize, #relation, #reset_token!, #sensitive_fields, #token_with_expiration, #write_new_token
Instance Method Details
#find_token_authenticatable(token, unscoped = false) ⇒ Object
10
11
12
13
14
|
# File 'lib/authn/token_field/digest.rb', line 10
def find_token_authenticatable(token, unscoped = false)
return unless token
relation(unscoped).find_by(token_field_name => encode(token)) end
|
#get_token(token_owner_record) ⇒ Object
16
17
18
|
# File 'lib/authn/token_field/digest.rb', line 16
def get_token(token_owner_record)
token_owner_record.cleartext_tokens&.[](token_field)
end
|
#set_token(token_owner_record, token) ⇒ Object
24
25
26
27
28
29
30
|
# File 'lib/authn/token_field/digest.rb', line 24
def set_token(token_owner_record, token)
return unless token
token_owner_record.cleartext_tokens ||= {}
token_owner_record.cleartext_tokens[token_field] = token
token_owner_record[token_field_name] = encode(token)
end
|
#token_fields ⇒ Object
6
7
8
|
# File 'lib/authn/token_field/digest.rb', line 6
def token_fields
super + [token_field_name]
end
|