store: extend User with AuthSource/OIDCSubject; Session with IDToken

This commit is contained in:
2026-05-05 13:09:49 +01:00
parent c5b29b88b9
commit 154b57a4cd
+16 -2
View File
@@ -16,8 +16,18 @@ type User struct {
Email *string // optional; nil = not set Email *string // optional; nil = not set
DisabledAt *time.Time // nil = enabled DisabledAt *time.Time // nil = enabled
MustChangePassword bool MustChangePassword bool
CreatedAt time.Time // AuthSource is "local" (created by admin or bootstrap) or
LastLoginAt *time.Time // "oidc" (JIT-provisioned on first OIDC sign-in). Local users
// authenticate via password; OIDC users via the IdP and have an
// empty PasswordHash.
AuthSource string
// OIDCSubject is the stable 'sub' claim from the IdP. Set only
// when AuthSource == "oidc". Used for fast lookup on subsequent
// sign-ins; the username/email may change at the IdP but sub
// stays stable.
OIDCSubject *string
CreatedAt time.Time
LastLoginAt *time.Time
} }
// Role enumerates the access tiers from spec.md §7.2. // Role enumerates the access tiers from spec.md §7.2.
@@ -40,6 +50,10 @@ type Session struct {
ExpiresAt time.Time ExpiresAt time.Time
IP string IP string
UA string UA string
// IDToken is the OIDC id_token captured at sign-in for OIDC
// sessions; empty for local-user sessions. Used as
// id_token_hint on RP-initiated logout.
IDToken string
} }
// Host mirrors the hosts table. The P2 redesign moved repo-related // Host mirrors the hosts table. The P2 redesign moved repo-related