Class: RailsBase::Authentication::MfaSetEncryptToken
- Inherits:
-
ServiceBase
- Object
- ServiceBase
- RailsBase::Authentication::MfaSetEncryptToken
show all
- Defined in:
- app/services/rails_base/authentication/mfa_set_encrypt_token.rb
Instance Method Summary
collapse
Methods inherited from ServiceBase
inherited, #internal_validate, #service_base_logging
#aletered_message, #class_name, #log, #log_prefix, #logger, #service_id
Instance Method Details
#call ⇒ Object
7
8
9
10
11
12
13
14
15
|
# File 'app/services/rails_base/authentication/mfa_set_encrypt_token.rb', line 7
def call
params = {
value: value,
purpose: purpose || Constants::MSET_PURPOSE,
expires_at: expires_at
}
context.encrypted_val = RailsBase::Encryption.encode(**params)
end
|
#validate! ⇒ Object
25
26
27
28
29
30
|
# File 'app/services/rails_base/authentication/mfa_set_encrypt_token.rb', line 25
def validate!
raise "Expected user to be a User. Received #{user.class}" unless user.is_a? User
time_class = ActiveSupport::TimeWithZone
raise "Expected expires_at to be a Received #{time_class}. Received #{expires_at.class}" unless expires_at.is_a? time_class
end
|
#value ⇒ Object
17
18
19
20
21
22
23
|
# File 'app/services/rails_base/authentication/mfa_set_encrypt_token.rb', line 17
def value
{ user_id: user.id, rand: rand.to_s, expires_at: expires_at }.to_json
end
|