feat(store): add per-organization sso providers and linked identities

Identities are keyed by provider and subject. Both tables are tenant
scoped; org_id_by_slug resolves a slug before sign-in without opening a
broader scope.

Refs #4

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
This commit is contained in:
Sebastian UnterschützandClaude Opus 5.5 committed 2026-11-22 00:30:43 +01:00
1 parent c485d1a96f
commit d1976ed57a
8 files changed
+544

No files matched your search

+25
View File
@@ -26,6 +26,21 @@ type Org struct {
RequireTotp bool
}
type SsoProvider struct {
ID uuid.UUID
OrgID uuid.UUID
Name string
Issuer string
ClientID string
ClientSecret []byte
Scopes []string
AllowedDomains []string
AutoProvision bool
Enabled bool
CreatedAt time.Time
UpdatedAt time.Time
}
type User struct {
ID uuid.UUID
Email string
@@ -38,3 +53,13 @@ type User struct {
TotpEnabledAt *time.Time
Locale *string
}
type UserIdentity struct {
ProviderID uuid.UUID
Subject string
OrgID uuid.UUID
UserID uuid.UUID
Email *string
CreatedAt time.Time
LastLoginAt time.Time
}