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
15 changes: 11 additions & 4 deletions app/services/out_of_band_session_accessor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def load_x509
end

def destroy
session_store.send(:destroy_session_from_sid, session_uuid, drop: true)
session_store.send(:delete_session, {}, Rack::Session::SessionId.new(session_uuid), drop: true)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😭 it's a bummer these are still private methods

end

# @api private
Expand Down Expand Up @@ -60,13 +60,20 @@ def put(data, expiration = 5.minutes)
'warden.user.user.session' => data.to_h,
}

session_store.
send(:set_session, {}, session_uuid, session_data, expire_after: expiration.to_i)
session_store.send(
:write_session,
{},
Rack::Session::SessionId.new(session_uuid),
session_data,
expire_after: expiration.to_i,
)
end

# @return [Hash]
def session_data
@session_data ||= session_store.send(:load_session_from_redis, session_uuid) || {}
@session_data ||= session_store.send(
:find_session, {}, Rack::Session::SessionId.new(session_uuid)
).last || {}
end

def session_store
Expand Down
3 changes: 3 additions & 0 deletions config/initializers/session_store.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
# cookie expires with browser close
expire_after: nil,

write_fallback: true,
read_fallback: true,

# Redis expires session after N minutes
ttl: IdentityConfig.store.session_timeout_in_minutes.minutes,

Expand Down
8 changes: 7 additions & 1 deletion spec/services/access_token_verifier_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@
subject(:verifier) { AccessTokenVerifier.new(http_authorization_header) }
let(:http_authorization_header) { "Bearer #{access_token}" }

let(:identity) { build(:service_provider_identity, access_token: SecureRandom.urlsafe_base64) }
let(:identity) do
build(
:service_provider_identity,
rails_session_id: '123',
access_token: SecureRandom.urlsafe_base64,
)
end

describe '#submit' do
let(:result) { verifier.submit }
Expand Down
1 change: 1 addition & 0 deletions spec/services/id_token_builder_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
nonce: SecureRandom.hex,
uuid: SecureRandom.uuid,
ial: 2,
rails_session_id: '123',
# this is a known value from an example developer guide
# https://www.pingidentity.com/content/developer/en/resources/openid-connect-developers-guide.html
access_token: 'dNZX1hEZ9wBCzNL40Upu646bdzQA',
Expand Down