Class: OpenidUserIdentity

Inherits:
UserIdentity show all
Defined in:
app/models/openid_user_identity.rb

Overview

Subclasses the UserIdentity class in order to override the redis namespace and thereby partition user sessions for va.gov from openid client applications.

Constant Summary

Constants inherited from Common::RedisStore

Common::RedisStore::REQ_CLASS_INSTANCE_VARS

Class Method Summary collapse

Methods inherited from UserIdentity

#loa3?

Methods inherited from Common::RedisStore

create, delete, #destroy, #destroyed?, exists?, #expire, find, find_or_build, #initialize, #initialize_dup, keys, #persisted?, pop, redis_key, redis_store, redis_ttl, #save, #save!, #ttl, #update, #update!

Constructor Details

This class inherits a constructor from Common::RedisStore

Class Method Details

.build_from_profile(uuid:, profile:, ttl:) ⇒ OpenidUserIdentity

Parameters:

  • uuid (String)

    the UUID of the user, as they are known to the upstream identity provider.

  • profile (Okta::UserProfile)

    the profile of the user, as they are known to okta.

  • ttl (Integer)

    the time to store the identity in redis.

Returns:



16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'app/models/openid_user_identity.rb', line 16

def self.build_from_profile(uuid:, profile:, ttl:)
  identity = new(
    uuid:,
    email: profile['email'],
    first_name: profile['firstName'],
    middle_name: profile['middleName'],
    last_name: profile['lastName'],
    mhv_icn: profile['icn'],
    icn: profile['icn'],
    loa: profile.derived_loa
  )
  identity.expire(ttl)
  identity
end