Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions app/services/out_of_band_session_accessor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ def put_empty_user_session(expiration = 5.minutes)
# @api private
# Only used for convenience in tests
# @param [Pii::Attributes] pii
# @param [#to_s] profile_id
def put_pii(profile_id:, pii:, expiration: 5.minutes)
def put_pii(profile_id, pii, expiration = 5.minutes)
data = {
decrypted_pii: pii.to_h.to_json,
encrypted_profiles: { profile_id.to_s => SessionEncryptor.new.kms_encrypt(pii.to_h.to_json) },
Expand Down
2 changes: 1 addition & 1 deletion spec/controllers/saml_idp_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@
it 'accepts requests with correct cert and correct session index and renders logout response' do
REDIS_POOL.with { |client| client.flushdb }
session_accessor = OutOfBandSessionAccessor.new(session_id)
session_accessor.put_pii(profile_id: 123, pii: { foo: 'bar' })
session_accessor.put_pii(123, foo: 'bar')
saml_request = OneLogin::RubySaml::Logoutrequest.new
encoded_saml_request = UriService.params(
saml_request.create(right_cert_settings),
Expand Down
6 changes: 3 additions & 3 deletions spec/models/user_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -926,9 +926,9 @@
it 'logs out the suspended user from the active session' do
# Add information to session store to allow `exists?` check to work as desired
OutOfBandSessionAccessor.new(mock_session_id).put_pii(
profile_id: 123,
pii: { first_name: 'Mario' },
expiration: 5.minutes.to_i,
123,
{ first_name: 'Mario' },
5.minutes.to_i,
)

expect(OutOfBandSessionAccessor.new(mock_session_id).exists?).to eq true
Expand Down
6 changes: 1 addition & 5 deletions spec/presenters/openid_connect_user_info_presenter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,7 @@
end

before do
OutOfBandSessionAccessor.new(rails_session_id).put_pii(
profile_id: profile.id,
pii: pii,
expiration: 5.minutes.to_i,
)
OutOfBandSessionAccessor.new(rails_session_id).put_pii(profile.id, pii, 5.minutes.to_i)
end

context 'when the identity has ial2 access' do
Expand Down
6 changes: 3 additions & 3 deletions spec/services/access_token_verifier_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@
before do
identity.save!
OutOfBandSessionAccessor.new(identity.rails_session_id).put_pii(
profile_id: 123,
pii: {},
expiration: 5,
123,
{},
5,
)
end

Expand Down
18 changes: 3 additions & 15 deletions spec/services/out_of_band_session_accessor_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,15 @@

describe '#ttl' do
it 'returns the remaining time-to-live of the session data in redis' do
store.put_pii(
profile_id: profile_id,
pii: { first_name: 'Fakey' },
expiration: 5.minutes.to_i,
)
store.put_pii(profile_id, { first_name: 'Fakey' }, 5.minutes.to_i)

expect(store.ttl).to be_within(1).of(5.minutes.to_i)
end
end

describe '#load_pii' do
it 'loads PII from the session' do
store.put_pii(
profile_id: profile_id,
pii: { dob: '1970-01-01' },
expiration: 5.minutes.to_i,
)
store.put_pii(profile_id, { dob: '1970-01-01' }, 5.minutes.to_i)

pii = store.load_pii(profile_id)
expect(pii).to be_kind_of(Pii::Attributes)
Expand All @@ -50,11 +42,7 @@

describe '#destroy' do
it 'destroys the session' do
store.put_pii(
profile_id: profile_id,
pii: { first_name: 'Fakey' },
expiration: 5.minutes.to_i,
)
store.put_pii(profile_id, { first_name: 'Fakey' }, 5.minutes.to_i)
store.destroy

expect(store.load_pii(profile_id)).to be_nil
Expand Down