Class: SignIn::SessionContainer

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Validations
Defined in:
app/models/sign_in/session_container.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(session:, refresh_token:, access_token:, anti_csrf_token:, client_config:, device_secret: nil) ⇒ SessionContainer

rubocop:disable Metrics/ParameterLists



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'app/models/sign_in/session_container.rb', line 25

def initialize(session:, # rubocop:disable Metrics/ParameterLists
               refresh_token:,
               access_token:,
               anti_csrf_token:,
               client_config:,
               device_secret: nil)
  @session = session
  @refresh_token = refresh_token
  @access_token = access_token
  @anti_csrf_token = anti_csrf_token
  @client_config = client_config
  @device_secret = device_secret

  validate!
end

Instance Attribute Details

#access_tokenObject (readonly)

Returns the value of attribute access_token.



7
8
9
# File 'app/models/sign_in/session_container.rb', line 7

def access_token
  @access_token
end

#anti_csrf_tokenObject (readonly)

Returns the value of attribute anti_csrf_token.



7
8
9
# File 'app/models/sign_in/session_container.rb', line 7

def anti_csrf_token
  @anti_csrf_token
end

#client_configObject (readonly)

Returns the value of attribute client_config.



7
8
9
# File 'app/models/sign_in/session_container.rb', line 7

def client_config
  @client_config
end

#device_secretObject (readonly)

Returns the value of attribute device_secret.



7
8
9
# File 'app/models/sign_in/session_container.rb', line 7

def device_secret
  @device_secret
end

#refresh_tokenObject (readonly)

Returns the value of attribute refresh_token.



7
8
9
# File 'app/models/sign_in/session_container.rb', line 7

def refresh_token
  @refresh_token
end

#sessionObject (readonly)

Returns the value of attribute session.



7
8
9
# File 'app/models/sign_in/session_container.rb', line 7

def session
  @session
end

Instance Method Details

#contextObject



45
46
47
48
49
50
51
52
53
# File 'app/models/sign_in/session_container.rb', line 45

def context
  {
    user_uuid: access_token.to_s[:user_uuid],
    session_handle: session.handle,
    client_id: session.client_id,
    type: session.user_verification.credential_type,
    icn: session..icn
  }
end

#persisted?Boolean

Returns:

  • (Boolean)


41
42
43
# File 'app/models/sign_in/session_container.rb', line 41

def persisted?
  false
end