Skip to content

feat(sso): several SSO connections per organization - #7077

Merged
OmarMcAdam merged 4 commits into
devfrom
multiple-sso-providers-per-org
Nov 6, 2026
Merged

OmarMcAdam merged 4 commits into
devfrom
multiple-sso-providers-per-org

Conversation

@OmarMcAdam

@OmarMcAdam OmarMcAdam commented Nov 5, 2026 •

Copy link
Copy Markdown
Member

What is this about?

Den SSO: an organization can set up several SSO connections, each with its own identity provider and one or more email domains, and people pick their provider at sign-in.

What problem does it solve?

Organizations with more than one identity provider (an acquisition, contractors on a separate tenant) or several email domains could not bring them all into OpenWork; one connection with one domain was the limit.

What was the situation before?

The SSO page edited a single connection with a single domain. Adding another provider meant replacing the first one, and sign-in always went to that one provider.

How is this implemented?

  • Behind multipleSsoConnections (cloud and self-hosted, off); internal doc: docs/features/multiple-sso-connections/README.md. Safe to kill: every enabled connection keeps signing people in, and the SSO page goes back to managing the oldest connection.
  • DB: sso_connection.organization_id no longer unique, new name column (migration 0183_multiple_sso_connections). Domains are stored comma separated, Better Auth's multi-domain format, and matched with FIND_IN_SET (sso-domains.ts).
  • API: /v1/sso/connections (list, add, get, rename, delete, test, enable, disable, domain verification, metadata per connection). /v1/sso/* keeps managing the oldest connection. A connection added next to others uses its own id as provider id (the org-derived id plus a suffix exceeds Better Auth's 63-character DNS label).
  • Sign-in: login-options returns ssoProviders; new public GET /v1/auth/sso-options feeds /sso/<slug>. A /sign-in/sso naming only an org, domain or email now gets the ready connection Den picked instead of Better Auth's arbitrary one.
  • Den Web: SSO page lists connections with their state; sso-connection-panel.tsx manages one; sign-in shows one button per provider.

What else changed?

  • sso_connection.renamed audit event; connection audit snapshots include name.
  • The single-connection SSO screen was split into sso-connection-panel.tsx (no behavior change with the flag off).
  • .devcontainer/start-daytona-server.sh: Den on Daytona could not build Den Web (dev too): a full install over the snapshot's filtered install hoists the landing site's @types/react 18 where Next's declarations find it. The script now points that hoist at Den Web's version. Freshly built server snapshots run MySQL 8 (root uses auth_socket), so the script gives root a password plugin.

Release note

Organizations can connect several identity providers and email domains for single sign-on, and people choose their provider when they sign in.

Evidence

evals/proofs/sso-multiple-connections.proof.test.ts (passes locally and on Daytona against this branch): an owner sees three connections with their states, opens and adds one; someone on the domain gets "Continue with Okta" and "Continue with Microsoft Entra ID"; the subsidiary domain gets only its provider; /sso/<slug> offers the same choice. Real OIDC sign-ins, per-connection tests and enable/disable are covered in ee/apps/den-api/test/api/sso-multiple-connections.api.test.ts.

Design: P1, P6, S2, C1, V2

@vercel

vercel Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

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

4 Skipped Deployments
Project Deployment Actions Updated
openwork-app Skipped Skipped Nov 6, 2026 12:18am UTC
openwork-den Skipped Skipped Nov 6, 2026 12:18am UTC
openwork-diagnostics Skipped Skipped Nov 6, 2026 12:18am UTC
openwork-landing Skipped Skipped Nov 6, 2026 12:18am UTC

Request Review

@diff-warden

diff-warden Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Warden: advisory — confidentiality findings

Confidentiality review flagged 1 item that may identify a customer, prospect, partner, or outside person (see AGENTS.md). Details stay out of this public comment; check the lines this PR adds.

Warden does not block merging or grant or withdraw approvals. Tests and human review remain separate requirements.

Reviewed 1eec1a3c23ca · Warden run · Updates after every Warden run.

Behind multipleSsoConnections (cloud and self-hosted, off). An organization
can add several SSO connections, each with its own identity provider, name
and one or more email domains, verified, tested and enabled on its own.
Sign-in lists every ready provider that covers the email, and a sign-in
through any of them satisfies Require SSO.
A full install over the server snapshot's filtered install can hoist the
landing site's @types/react 18 where Next's own declarations find it, so
Den Web's type check fails on ReactNode (dev too). Point the hidden hoist at
Den Web's version. Freshly built snapshots run MySQL 8, whose root@localhost
uses auth_socket and ignores the password Den connects with; give it a
password plugin.
MySQL has no CREATE INDEX / ADD COLUMN IF NOT EXISTS, so each step checks
information_schema first and runs through a prepared statement, as
0004_organization_plugin does.
@vercel
vercel Bot temporarily deployed to Preview – openwork-landing November 6, 2026 00:18 Inactive
@vercel
vercel Bot temporarily deployed to Preview – openwork-app November 6, 2026 00:18 Inactive
@vercel
vercel Bot temporarily deployed to Preview – openwork-diagnostics November 6, 2026 00:18 Inactive
@vercel
vercel Bot temporarily deployed to Preview – openwork-den November 6, 2026 00:18 Inactive
@OmarMcAdam
OmarMcAdam merged commit e644ee3 into dev Nov 6, 2026
21 checks passed

This branch was previously deployed

4 inactive deployments
Preview – openwork-landing — 757714b6 Deployed Nov 6, 2026 by vercel[bot]
Preview – openwork-app — 757714b6 Deployed Nov 6, 2026 by vercel[bot]
Preview – openwork-diagnostics — 757714b6 Deployed Nov 6, 2026 by vercel[bot]
Preview – openwork-den — 757714b6 Deployed Nov 6, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant