Repository navigation
feat(users): Microsoft sign-in over OpenID Connect with PKCE and nonce (#876) - #920
Merged
Merged
Conversation
#876) The Microsoft provider signs in from the validated ID token (RS256 against Entra's JWKS, exact issuer, aud/azp, exp/iat, nonce) instead of Graph /me. A GUID tenant requires a matching tid; common/organizations/consumers check the token's own issuer. The account id stays Graph-compatible, so existing links keep matching. The generic callback passes the whole token response to get_identity and keeps a per-login PKCE verifier and nonce in the session for providers that opt in. Claude-Session: https://claude.ai/code/session_01M9neheZZEe3sVpDi2S3zT4
Compare the OAuth state before spending the pending login; route identity by client capability; a non-email preferred_username is no email; doc and comment corrections from review. Claude-Session: https://claude.ai/code/session_01M9neheZZEe3sVpDi2S3zT4
…876) An idp naming the token's own tenant (v1 or v2 issuer) no longer blocks trusted linking, and the optional upn claim wins over preferred_username so alternate-login aliases keep matching invites by UPN. Claude-Session: https://claude.ai/code/session_01M9neheZZEe3sVpDi2S3zT4
Non-string idp is a guest (no 500), log why a provider sign-in was refused, docs say upn-first. Claude-Session: https://claude.ai/code/session_01M9neheZZEe3sVpDi2S3zT4
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Deploying simple-module-python with
|
| Latest commit: |
1c6e585
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://baabb0ad.simple-module-python.pages.dev |
| Branch Preview URL: | https://feat-issue-876-microsoft-oid.simple-module-python.pages.dev |
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.
Summary
/me. The token checks reuseauth.oidc_common.jwks.JWKSCache:…/<tid>/v2.0;audandazp,exp/iat, and the nonce.tidto match it.organizationsrefuses personal accounts, andconsumersaccepts only them. Nothing is fetched at boot.oidfor work and school accounts, and for personal accounts the last 16 hex digits ofoid. Existing links keep matching with no migration.upnclaim when present, elsepreferred_username. It must be an email address, so a phone-number username counts as no email. The users: Microsoft (Entra) OAuth cannot sign in pre-approved accounts; add a trusted single-tenant UPN policy #873 trusted-tenant policy now also treats anidpclaim naming another issuer as a guest.OAuthProvider.get_identity(token, login).docs/modules/users.md, and the CHANGELOG.openid,profileandemaildelegated permissions. GraphUser.Readis no longer requested.get_identitywith an access-token string must now pass the token response dict.docs/superpowers/specs/2026-11-11-microsoft-oidc-provider-design.md.Closes #876
Verification
oid/tid, foreignazp, the tenant-segment rules, a signedtidthat doesn't match the issuer, the trust rule (guests byidpor#EXT#, a home-tenantidp, a list-valuedidp), the account-id mapping, andupnversus an alternate-login alias;make lintpasses,make test-pyhas 8397 passed and 28 skipped,make test-jshas 906 passed.idpwas wrongly treated as a guest, and that an alternate-login alias replaced the UPN. Both are fixed.Test plan
commonand through a pinned tenant GUID. An existing Graph-era link still signs in, and a token from another tenant is refused.https://claude.ai/code/session_01M9neheZZEe3sVpDi2S3zT4