fix(portal): ask the identity provider for the account chooser and hint the tenant domain - #962
Open
ramybarsoum wants to merge 1 commit into
Open
fix(portal): ask the identity provider for the account chooser and hint the tenant domain#962ramybarsoum wants to merge 1 commit into
ramybarsoum wants to merge 1 commit into
Conversation
…nt the tenant domain Google reuses whichever account the browser is signed into, and when that account fails the OIDC_ALLOWED_EMAIL_DOMAIN gate the user is refused with no way to pick another one. The portal now forwards OIDC_PROMPT as the prompt parameter when it is configured, and for the Google issuer sends OIDC_ALLOWED_EMAIL_DOMAIN as the hd hint so the chooser opens filtered to the tenant. Both hints are opt-in and absent by default; server-side domain enforcement is unchanged. hostedDomainHint() holds the issuer gate so both paths are unit-tested, and OIDC_PROMPT joins the portal's Fly stack keys.
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.
Problem
When the portal runs against Google as the OIDC issuer, the authorize request carries neither
promptnorhd. Google therefore reuses whichever account the browser is already signed into. If that account is outsideOIDC_ALLOWED_EMAIL_DOMAIN, the user is refused after the round trip with no way to pick a different account, and every retry repeats the same auto-selection.Change
plugins/portal/src/oidc.ts:OidcConfiggains optionalpromptandhostedDomain.buildAuthorizeUrlforwards them asprompt=andhd=only when set. NewhostedDomainHint(issuer, allowedEmailDomain)returns the hint only for the Google issuer with a domain gate configured.plugins/portal/src/index.ts:promptcomes from a new optionalOIDC_PROMPTenv var;hostedDomaincomes fromhostedDomainHint.cli/src/services.ts:OIDC_PROMPTadded to the portal's Fly stack keys so a stack can set it.hostedDomainHintcovers Google with a domain, Google without a domain, and a non-Google issuer with a domain.Both hints are opt-in and absent by default, so the Slack issuer and existing deployments are unchanged.
hdis a chooser hint only; server-side domain enforcement is untouched.Verification
plugins/portal: 116/116 tests pass;plugins/portalandclitypechecks pass. No rendered surface changes; the only user-visible effect is Google's own account chooser appearing whenOIDC_PROMPT=select_accountis configured.Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.