Class: ActiveRecord::TokenFor::TokenDefinition
Do not use. This class is for internal use only.
Relationships & Source Files | |
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
self,
::Struct
|
|
Instance Chain:
self,
::Struct
|
|
Inherits: | Struct |
Defined in: | activerecord/lib/active_record/token_for.rb |
Instance Attribute Summary
- #block rw
- #defining_class rw
- #expires_in rw
- #purpose rw
Instance Method Summary
::Struct
- Inherited
Instance Attribute Details
#block (rw)
[ GitHub ]# File 'activerecord/lib/active_record/token_for.rb', line 14
TokenDefinition = Struct.new(:defining_class, :purpose, :expires_in, :block)
#defining_class (rw)
[ GitHub ]# File 'activerecord/lib/active_record/token_for.rb', line 14
TokenDefinition = Struct.new(:defining_class, :purpose, :expires_in, :block)
#expires_in (rw)
[ GitHub ]# File 'activerecord/lib/active_record/token_for.rb', line 14
TokenDefinition = Struct.new(:defining_class, :purpose, :expires_in, :block)
#purpose (rw)
[ GitHub ]# File 'activerecord/lib/active_record/token_for.rb', line 14
TokenDefinition = Struct.new(:defining_class, :purpose, :expires_in, :block)
Instance Method Details
#full_purpose
[ GitHub ]# File 'activerecord/lib/active_record/token_for.rb', line 15
def full_purpose @full_purpose ||= [defining_class.name, purpose, expires_in].join("\n") end
#generate_token(model)
[ GitHub ]# File 'activerecord/lib/active_record/token_for.rb', line 27
def generate_token(model) .generate(payload_for(model), expires_in: expires_in, purpose: full_purpose) end
#message_verifier
[ GitHub ]# File 'activerecord/lib/active_record/token_for.rb', line 19
def defining_class.generated_token_verifier end
#payload_for(model)
[ GitHub ]#resolve_token(token)
[ GitHub ]# File 'activerecord/lib/active_record/token_for.rb', line 31
def resolve_token(token) payload = .verified(token, purpose: full_purpose) model = yield(payload[0]) if payload model if model && payload_for(model) == payload end