Skip to content

feat(auth): oidcAuthorizeGate seam for OIDC OP app-assignment (ADR-0024 D5.1)#2343

Merged
os-zhuang merged 1 commit into
mainfrom
feat/oidc-authorize-gate
Jun 26, 2026
Merged

feat(auth): oidcAuthorizeGate seam for OIDC OP app-assignment (ADR-0024 D5.1)#2343
os-zhuang merged 1 commit into
mainfrom
feat/oidc-authorize-gate

Conversation

@os-zhuang

Copy link
Copy Markdown
Contributor

Optional host-supplied authorization gate for the OIDC OP. better-auth's oauth-provider authenticates the subject but never authorizes it against the requesting client — it mints a code for any logged-in user and any registered client. This adds oidcAuthorizeGate?({userId, clientId}) to the auth config; when set, the /oauth2/authorize before-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

…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>
@vercel

vercel Bot commented Jun 26, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
spec Building Building Preview, Comment Jun 26, 2026 11:12am

Request Review

@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 1 package(s): @objectstack/plugin-auth.

10 hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:

  • content/docs/concepts/implementation-status.mdx (via @objectstack/plugin-auth)
  • content/docs/concepts/packages.mdx (via @objectstack/plugin-auth)
  • content/docs/getting-started/cli.mdx (via @objectstack/plugin-auth)
  • content/docs/guides/auth-sso.mdx (via @objectstack/plugin-auth)
  • content/docs/guides/authentication.mdx (via @objectstack/plugin-auth)
  • content/docs/guides/kernel-services.mdx (via @objectstack/plugin-auth)
  • content/docs/guides/packages.mdx (via @objectstack/plugin-auth)
  • content/docs/guides/plugins.mdx (via @objectstack/plugin-auth)
  • content/docs/guides/production-readiness.mdx (via @objectstack/plugin-auth)
  • content/docs/releases/v9.mdx (via @objectstack/plugin-auth)

Advisory only. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs origin/main → pass the list as args.docs.

@os-zhuang
os-zhuang merged commit 831085e into main Jun 26, 2026
14 of 15 checks passed
@os-zhuang
os-zhuang deleted the feat/oidc-authorize-gate branch June 26, 2026 11:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant