Class: SignIn::AccessToken

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(session_handle:, client_id:, user_uuid:, audience:, refresh_token_hash:, anti_csrf_token:, last_regeneration_time:, uuid: nil, parent_refresh_token_hash: nil, version: nil, expiration_time: nil, created_time: nil, user_attributes: nil) ⇒ AccessToken

rubocop:disable Metrics/ParameterLists



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'app/models/sign_in/access_token.rb', line 41

def initialize(session_handle:,
               client_id:,
               user_uuid:,
               audience:,
               refresh_token_hash:,
               anti_csrf_token:,
               last_regeneration_time:,
               uuid: nil,
               parent_refresh_token_hash: nil,
               version: nil,
               expiration_time: nil,
               created_time: nil,
               user_attributes: nil)
  @uuid = uuid || create_uuid
  @session_handle = session_handle
  @client_id = client_id
  @user_uuid = user_uuid
  @audience = audience
  @refresh_token_hash = refresh_token_hash
  @anti_csrf_token = anti_csrf_token
  @last_regeneration_time = last_regeneration_time
  @parent_refresh_token_hash = parent_refresh_token_hash
  @version = version || Constants::AccessToken::CURRENT_VERSION
  @expiration_time = expiration_time || set_expiration_time
  @created_time = created_time || set_created_time
  @user_attributes = filter_user_attributes(user_attributes:)

  validate!
end

Instance Attribute Details

#anti_csrf_tokenObject (readonly)

Returns the value of attribute anti_csrf_token.



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

def anti_csrf_token
  @anti_csrf_token
end

#audienceObject (readonly)

Returns the value of attribute audience.



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

def audience
  @audience
end

#client_idObject (readonly)

Returns the value of attribute client_id.



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

def client_id
  @client_id
end

#created_timeObject (readonly)

Returns the value of attribute created_time.



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

def created_time
  @created_time
end

#expiration_timeObject (readonly)

Returns the value of attribute expiration_time.



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

def expiration_time
  @expiration_time
end

#last_regeneration_timeObject (readonly)

Returns the value of attribute last_regeneration_time.



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

def last_regeneration_time
  @last_regeneration_time
end

#parent_refresh_token_hashObject (readonly)

Returns the value of attribute parent_refresh_token_hash.



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

def parent_refresh_token_hash
  @parent_refresh_token_hash
end

#refresh_token_hashObject (readonly)

Returns the value of attribute refresh_token_hash.



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

def refresh_token_hash
  @refresh_token_hash
end

#session_handleObject (readonly)

Returns the value of attribute session_handle.



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

def session_handle
  @session_handle
end

#user_attributesObject (readonly)

Returns the value of attribute user_attributes.



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

def user_attributes
  @user_attributes
end

#user_uuidObject (readonly)

Returns the value of attribute user_uuid.



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

def user_uuid
  @user_uuid
end

#uuidObject (readonly)

Returns the value of attribute uuid.



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

def uuid
  @uuid
end

#versionObject (readonly)

Returns the value of attribute version.



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

def version
  @version
end

Instance Method Details

#persisted?Boolean

rubocop:enable Metrics/ParameterLists

Returns:

  • (Boolean)


72
73
74
# File 'app/models/sign_in/access_token.rb', line 72

def persisted?
  false
end

#to_sObject



76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'app/models/sign_in/access_token.rb', line 76

def to_s
  {
    uuid:,
    user_uuid:,
    session_handle:,
    client_id:,
    audience:,
    version:,
    last_regeneration_time: last_regeneration_time.to_i,
    created_time: created_time.to_i,
    expiration_time: expiration_time.to_i
  }
end