feat(auth): oidcAuthorizeGate seam for OIDC OP app-assignment (ADR-0024 D5.1)#2343
Merged
Conversation
…R-0024 D5.1) better-auth's oauth-provider AUTHENTICATES a subject but does NOT AUTHORIZE it against the requesting client — it issues a code to any logged-in user for any registered client. This adds an optional host-supplied gate, invoked on /oauth2/authorize for an authenticated subject before a code is issued, so a multi-tenant OP (the cloud control plane) can enforce app-assignment (org-membership): a cloud user may only obtain a code for an env client (project_<envId>) of an org they belong to. Unset (open editions / self-host, where the OP is not multi-tenant) = allow, behavior unchanged. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
📓 Docs Drift CheckThis PR changes 1 package(s): 10 hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:
|
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.
Optional host-supplied authorization gate for the OIDC OP. better-auth's
oauth-providerauthenticates the subject but never authorizes it against the requesting client — it mints a code for any logged-in user and any registered client. This addsoidcAuthorizeGate?({userId, clientId})to the auth config; when set, the/oauth2/authorizebefore-hook calls it for an authenticated subject and denies (no code) on false.The cloud control plane will supply it to enforce org-membership (app-assignment) — closing a verified cross-tenant hole (any cloud user could SSO into any tenant's env). Unset (open editions / self-host) = allow, unchanged. Pairs with cloud-side ADR-0024 D5.1 impl.
🤖 Generated with Claude Code