diff --git a/app/services/pii/session_store.rb b/app/services/pii/session_store.rb deleted file mode 100644 index f585395e428..00000000000 --- a/app/services/pii/session_store.rb +++ /dev/null @@ -1,33 +0,0 @@ -# Provides a way to access already-decrypted and cached PII from the redis -# in an out-of-band fashion (using only the session UUID) instead of having access -# to the user_session from Devise/Warden -# Should only be used outside of a normal browser session (such as the OpenID Connect API) -# See Pii::Cacher for accessing PII inside of a normal browser session -module Pii - class SessionStore - attr_reader :session_accessor - - delegate :ttl, :destroy, to: :session_accessor - - def initialize(session_uuid) - @session_accessor = OutOfBandSessionAccessor.new(session_uuid) - end - - def load - session = session_accessor.load - - Pii::Cacher.new(nil, session.dig('warden.user.user.session')).fetch - end - - # @api private - # Only used for convenience in tests - # @param [Pii::Attributes] pii - def put(pii, expiration = 5.minutes) - session_data = { - decrypted_pii: pii.to_h.to_json, - } - - session_accessor.put(session_data, expiration) - end - end -end diff --git a/app/services/x509/session_store.rb b/app/services/x509/session_store.rb deleted file mode 100644 index 174b6cfb9d4..00000000000 --- a/app/services/x509/session_store.rb +++ /dev/null @@ -1,45 +0,0 @@ -# Provides a way to access already-decrypted and cached PII from the redis -# in an out-of-band fashion (using only the session UUID) instead of having access -# to the user_session from Devise/Warden -# Should only be used outside of a normal browser session (such as the OpenID Connect API) -# See X509::Cacher for accessing PII inside of a normal browser session -module X509 - class SessionStore - attr_reader :session_uuid - - def initialize(session_uuid) - @session_uuid = session_uuid - end - - def ttl - uuid = session_uuid - session_store.instance_eval { redis.ttl(prefixed(uuid)) } - end - - def load - session = session_store.send(:load_session_from_redis, session_uuid) || {} - X509::Attributes.new_from_json(session.dig('warden.user.user.session', :decrypted_x509)) - end - - # @api private - # Only used for convenience in tests - # @param [X509::Attributes] x509 - def put(piv_cert_info, expiration = 5.minutes) - session_data = { - 'warden.user.user.session' => { - decrypted_x509: piv_cert_info.to_h.to_json, - }, - } - - session_store. - send(:set_session, {}, session_uuid, session_data, expire_after: expiration.to_i) - end - - private - - def session_store - config = Rails.application.config - config.session_store.new({}, config.session_options) - end - end -end