Class: LinkedRails::Auth::OtpBase

Inherits:
ApplicationRecord
  • Object
show all
Extended by:
OtpHelper
Includes:
OtpHelper
Defined in:
app/models/linked_rails/auth/otp_base.rb

Direct Known Subclasses

OtpAttempt, OtpSecret

Instance Attribute Summary collapse

Class Method Summary collapse

Methods included from OtpHelper

handle_expired_session, owner_from_session, session_from_param

Instance Attribute Details

#encoded_sessionObject

Returns the value of attribute encoded_session.



22
23
24
# File 'app/models/linked_rails/auth/otp_base.rb', line 22

def encoded_session
  @encoded_session
end

#otp_attemptObject

Returns the value of attribute otp_attempt.



22
23
24
# File 'app/models/linked_rails/auth/otp_base.rb', line 22

def otp_attempt
  @otp_attempt
end

Class Method Details

.iri_templateObject



41
42
43
# File 'app/models/linked_rails/auth/otp_base.rb', line 41

def iri_template
  @iri_template ||= URITemplate.new("/#{route_key}{/id}{?session}{#fragment}")
end

.owner_for_otp(params, user_context) ⇒ Object



49
50
51
52
53
54
55
# File 'app/models/linked_rails/auth/otp_base.rb', line 49

def owner_for_otp(params, user_context)
  if params.key?(:session)
    owner_from_session(params[:session])
  else
    user_context unless user_context.guest?
  end
end

.singular_iri_templateObject



45
46
47
# File 'app/models/linked_rails/auth/otp_base.rb', line 45

def singular_iri_template
  @singular_iri_template ||= URITemplate.new("{/parent_iri*}/#{singular_route_key}{?session}{#fragment}")
end