feat: sign up and sign in with platform identity providers #123

Merged
Sebi merged 1 commits from feat/platform-sso into main 2026-11-23 16:16:45 +00:00
Owner

Admin panel → Sign-in providers (/api/v1/admin/identity-providers)

  • OpenID Connect (Google, Microsoft, GitLab, Keycloak, Authentik, …): issuer checked by discovery when saving.
  • GitHub (github.com or GitHub Enterprise): OAuth with PKCE; the account's primary email counts, and only if GitHub verified it. Added to internal/sso next to OIDC.
  • Name, client ID, client secret (sealed, never returned; empty on update keeps it), sign-up open, enabled. The callback URL to register is shown. Removing a provider is refused (409 idp_in_use) while accounts can sign in only through it — disable it instead.

Sign-in and sign-up

  • Login page: Continue with …; sign-up page: Sign up with … for providers open to sign-up — also when email sign-up is closed because no mail server is configured (the provider confirms the address).
  • Accounts are reached only through stored identities (provider + subject). A new identity signs up only with a provider-confirmed email, within the sign-up mode and per-address limit (#118). It never takes over an existing account — not even through an alias of its address (sso_link_required); the owner links the provider while signed in.
  • TOTP still applies: an account with a second factor continues at the TOTP step after the provider.
  • First-user mode: the first account, also via a provider, becomes the operator.

Security settings: linked providers with Disconnect (DELETE /api/v1/me/identities/:provider, refused as 409 last_sign_in when it is the only way to sign in) and Connect … buttons.

The shared /sso/callback handles organization and platform flows; organization SSO is unchanged. Migration 00045. Audited, documented, translated.

Tests: OIDC against the test IdP — sign-up → onboarding, repeated sign-in, no takeover by email or alias, unverified email refused, linking and signing in through the link, TOTP after the provider, last-sign-in guard, provider-in-use guard, sign-up closed per provider; GitHub against a fake GitHub Enterprise (PKCE verifier required, primary verified email, unverified refused); admin-only, secrets never listed. The test browser now takes the CSRF token from pages like the console script.

Closes #114

🤖 Generated with Claude Code

https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3

**Admin panel → Sign-in providers** (`/api/v1/admin/identity-providers`) - *OpenID Connect* (Google, Microsoft, GitLab, Keycloak, Authentik, …): issuer checked by discovery when saving. - *GitHub* (github.com or GitHub Enterprise): OAuth with PKCE; the account's **primary** email counts, and only if GitHub verified it. Added to `internal/sso` next to OIDC. - Name, client ID, client secret (sealed, never returned; empty on update keeps it), *sign-up open*, *enabled*. The callback URL to register is shown. Removing a provider is refused (`409 idp_in_use`) while accounts can sign in only through it — disable it instead. **Sign-in and sign-up** - Login page: *Continue with …*; sign-up page: *Sign up with …* for providers open to sign-up — also when email sign-up is closed because no mail server is configured (the provider confirms the address). - Accounts are reached **only through stored identities (provider + subject)**. A new identity signs up only with a provider-confirmed email, within the sign-up mode and per-address limit (#118). It never takes over an existing account — not even through an alias of its address (`sso_link_required`); the owner links the provider while signed in. - **TOTP still applies**: an account with a second factor continues at the TOTP step after the provider. - First-user mode: the first account, also via a provider, becomes the operator. **Security settings:** linked providers with *Disconnect* (`DELETE /api/v1/me/identities/:provider`, refused as `409 last_sign_in` when it is the only way to sign in) and *Connect …* buttons. The shared `/sso/callback` handles organization and platform flows; organization SSO is unchanged. Migration `00045`. Audited, documented, translated. **Tests:** OIDC against the test IdP — sign-up → onboarding, repeated sign-in, no takeover by email or alias, unverified email refused, linking and signing in through the link, TOTP after the provider, last-sign-in guard, provider-in-use guard, sign-up closed per provider; GitHub against a fake GitHub Enterprise (PKCE verifier required, primary verified email, unverified refused); admin-only, secrets never listed. The test browser now takes the CSRF token from pages like the console script. Closes #114 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
Sebi added this to the M12 Self-service signup & limits milestone 2026-11-23 00:26:32 +00:00
Sebi added 1 commit 2026-11-23 00:26:35 +00:00
feat: sign up and sign in with platform identity providers
ci / build (pull_request) Successful in 5m13s
ci / lint (pull_request) Successful in 5m45s
ci / image (pull_request) Successful in 6m20s
ci / test (pull_request) Successful in 11m46s
fe5c4fb24c
Platform admins register identity providers for the whole installation:
any OpenID Connect provider, checked by discovery, and GitHub or GitHub
Enterprise through OAuth, which reads the primary email GitHub verified.
Sign-in pages offer them; the sign-up page offers those open to sign-up,
also where email sign-up is closed for lack of a mail server.

Accounts are reached only through identities stored by subject. A new
identity signs up only with an email the provider confirmed, within the
per-address limit and sign-up mode, and never takes over an existing
account, including through an alias of its address: its owner links
the provider in the security settings. The account's TOTP still applies
after the provider. Unlinking refuses to remove the last way to sign in,
and removing a provider refuses while accounts depend on it.

The test browser takes the CSRF token from pages, as the console does.

Closes #114

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
Sebi merged commit 29b9e1ce2b into main 2026-11-23 16:16:45 +00:00
Sebi deleted branch feat/platform-sso 2026-11-23 16:16:47 +00:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: ZB-Server/uptimesebi#123