feat: Multi account sessions#296
Open
3kh0 wants to merge 4 commits into
Open
Conversation
auth_time_from_resource_owner picked `sessions.not_expired.order(created_at:
:desc).first` — the newest session for the identity, not the one that actually
authorized the request. Same bug in reauthenticate_resource_owner. Both blocks
also used `return`, which raises LocalJumpError under instance_exec.
Threads the real session through instead:
- Current.identity_session, set from ApplicationController per request
- oauth_access_grants.source_session_id stamped at authorization time (the
column and FK already existed in schema, unwritten)
- at code exchange the grant's session is attached to the IdToken, since the
token endpoint has no session cookie
- auth_time returns nil when neither source is available rather than guessing
Prerequisite for per-account authentication assurance once a browser can hold
more than one signed-in account.
Co-authored-by: 24c02 <163450896+24c02@users.noreply.github.com>
Co-authored-by: 24c02 <163450896+24c02@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When users have more than one HCA account for one reason or another, switching accounts is downright annoying. This adds a account switcher seen in indie services like Google.