feat: sign up and sign in with platform identity providers
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
This commit is contained in:
1 parent
1ad68e2e87
commit
fe5c4fb24c
26 files changed
+2710
-351
No files matched your search
@@ -40,6 +40,9 @@ type ssoFlow struct {
|
||||
// LinkUser is set when a signed-in user connects this IdP to their
|
||||
// existing account instead of signing in.
|
||||
LinkUser uuid.UUID `json:"link_user,omitempty"`
|
||||
// Platform marks a platform identity provider rather than an
|
||||
// organization's.
|
||||
Platform bool `json:"platform,omitempty"`
|
||||
}
|
||||
|
||||
// ssoError aborts a browser flow by redirecting with a code the target page
|
||||
@@ -206,6 +209,10 @@ func (s *Server) ssoCallback(c *gin.Context) {
|
||||
s.ssoAbort(c, f.LinkUser, "sso_denied")
|
||||
return
|
||||
}
|
||||
if f.Platform {
|
||||
s.platformCallback(c, f, state)
|
||||
return
|
||||
}
|
||||
|
||||
var row store.SsoProvider
|
||||
err = s.db.Tx(ctx, tenant.Org(f.Org, uuid.Nil), func(q *store.Queries) error {
|
||||
|
||||
Reference in new issue
Block a user