feat(auth): OIDC/Keycloak SSO-Login (additiv) — v1.2.91

SSO per OpenID Connect (Authorization Code + PKCE) zusätzlich zum lokalen Login.
- Regeln: kein Auto-Provisioning (E-Mail muss als User existieren), Rolle aus DB (nie aus Token), lokaler Login+TOTP unangetastet.
- Migration 0040: oidc_settings (Singleton, client_secret_enc via secrets.Box) + users.oidc_subject.
- internal/services/oidc: Settings-Repo (write-only Secret) + lazy go-oidc Client (testbarer Authenticator-Seam).
- internal/handlers/oidc.go: GET/PUT /oidc/settings (admin), GET /auth/oidc/{settings,login,callback}. Flow-State (state/PKCE/nonce) stateless im 5-min signierten HttpOnly-Cookie (SameSite=Lax). email_verified erzwungen, opportunistisches sub-Linking, Session via setSessionCookie+Signer.
- session.SignBlob/VerifyBlob; users.Get/SetOIDCSubject; main.go-Wiring.
- Frontend: App.tsx /auth/me-Bootstrap (für Cookie-Session nach Callback), Login-SSO-Button + sso_error, Settings OIDC-Card, i18n de/en.
- Tests (guarded EG_FWTEST_DSN): Secret-Roundtrip + Callback (Rolle-aus-DB, no_account, disabled, unverified, nonce, state).
Deps: go-oidc/v3, x/oauth2. Scope v1: nur Login (kein SLO/Refresh).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Debian
2026-06-05 16:04:13 +02:00
parent f85552a475
commit 3a707e2e3f
18 changed files with 1326 additions and 8 deletions

View File

@@ -289,6 +289,24 @@
"forgotPassword": "Forgot your password?",
"viewerBadge": "Read-only",
"viewerHint": "Your account has viewer role — all changes are blocked. Contact an admin to change your role.",
"sso": {
"login": "Sign in with SSO",
"err": {
"no_account": "No EdgeGuard account for this email. Please contact an administrator.",
"disabled": "This account is disabled.",
"unverified": "The email address is not verified at the identity provider.",
"state": "Security check failed (state). Please try again.",
"nonce": "Security check failed (nonce). Please try again.",
"token": "Could not verify the token from the identity provider.",
"exchange": "Code exchange with the identity provider failed.",
"expired": "The sign-in session expired. Please try again.",
"denied": "Sign-in at the identity provider was cancelled.",
"subject_mismatch": "The identity does not match the linked account.",
"config": "SSO is not configured correctly.",
"server": "Internal error during SSO sign-in.",
"generic": "SSO sign-in failed."
}
},
"totp": {
"prompt": "Enter the 6-digit code from your authenticator app.",
"verify": "Verify code",
@@ -907,6 +925,24 @@
"configPreviewBtn": "Load preview",
"configPreviewHint": "Renders the selected service config from the current DB state. Read-only — nothing is written to disk or reloaded.",
"configCopied": "Config copied to clipboard",
"oidc": {
"title": "Single Sign-On (OIDC)",
"intro": "SSO login via OpenID Connect (e.g. Keycloak), in addition to local login. Only existing users can sign in; the role is managed in EdgeGuard.",
"enabled": "SSO enabled",
"issuerUrl": "Issuer URL",
"issuerHint": "Realm base URL, e.g. https://keycloak.example.com/realms/edgeguard",
"clientId": "Client ID",
"clientSecret": "Client secret",
"secretSet": "Stored — leave empty to keep unchanged.",
"secretUnset": "No secret stored yet.",
"scopes": "Scopes",
"emailClaim": "Email claim",
"buttonLabel": "Button label",
"redirectUri": "Redirect URI",
"redirectHint": "Register this URL as a valid redirect URI in the Keycloak client (per cluster node its own FQDN).",
"saved": "OIDC settings saved",
"saveFailed": "Failed to save OIDC settings"
},
"passwordCardTitle": "Change admin password",
"currentPassword": "Current password",
"newPassword": "New password",
@@ -1287,6 +1323,7 @@
"common": {
"yes": "Yes",
"no": "No",
"or": "or",
"save": "Save",
"cancel": "Cancel",
"loading": "Loading …",