Skip to content

fix(auth): org-scope registered SSO/SAML providers so any org admin can manage them (ADR-0024 / cloud#551) - #2407

Merged
os-zhuang merged 1 commit into
mainfrom
adr-0024-sso-provider-org-scope
Jun 28, 2026
Merged

os-zhuang merged 1 commit into
mainfrom
adr-0024-sso-provider-org-scope

Conversation

@os-zhuang

Copy link
Copy Markdown
Contributor

Why

@better-auth/sso's provider-management endpoints (delete / update / request-/verify-domain) gate org-less providers on provider.userId === caller — so only the original registrar could delete or verify an IdP. A second org admin couldn't manage an IdP someone else registered.

What

The register bridges (OIDC + SAML) now resolve the caller's active organization — best-effort, via a /get-session re-dispatch through the same handler — and scope the provider to it. better-auth then gates management on isOrgAdmin instead, so any org owner/admin can manage the environment's IdPs. Falls back to org-less (no behaviour change) when no active org is set.

Verification (browser E2E)

  • A form-registered OIDC provider lands with organization_id = the env's org (org_seed_local) — was null.
  • Register 200 (no regression) and delete 200 (via the isOrgAdmin path).

This also unblocks any org admin (not just the registrar) using the domain-verification endpoints — the UI for that is a separate follow-up.

🤖 Generated with Claude Code

…an manage them (ADR-0024 / cloud#551)

@better-auth/sso gates ORG-LESS providers' delete/update/domain-verification on
provider.userId === caller (registrar-only). The register bridges now resolve the
caller's active org (best-effort /get-session re-dispatch) and scope the provider
to it, so management gates on isOrgAdmin — any org owner/admin can manage the
env's IdPs. Falls back to org-less when no active org (no regression).

Verified E2E: form-registered OIDC provider lands with organization_id = env org
(was null); register + delete still 200.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@vercel

vercel Bot commented Jun 28, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
spec Ready Ready Preview, Comment Jun 28, 2026 1:26am

Request Review

@github-actions github-actions Bot added documentation Improvements or additions to documentation tooling size/s labels Jun 28, 2026
@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.

This branch was successfully deployed

1 active deployment
Preview — 0d6fa975 Deployed Jun 28, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/s tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant