BFF-Routen + UI + i18n fuer Account-Sicherheit #162
Labels
No labels
component/backend
component/docs
component/e2e
component/frontend
component/infra
component/keycloak
prio/high
prio/low
prio/medium
type/bug
type/chore
type/feature
type/refactor
type/test
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
WompSchmiede/FamilienFeierPlaner#162
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Beschreibung
Das Frontend (BFF + UI) muss Account-Sicherheitseinstellungen erhalten: Passwort wechseln, TOTP/2FA einrichten, Passkeys (WebAuthn) registrieren und verwalten. Die Kommunikation mit Keycloak erfolgt via BFF-Proxy unter Verwendung des User-eigenen JWT (session_token) gegen die Keycloak Account Console API.
Abhaengig von #129 (Keycloak-Realm-Konfiguration).
Umsetzung
1. BFF-Routen (
frontend/src/routes/api/auth/)change-password/+server.ts—POST: Proxied anPOST /realms/{realm}/account/passwordmit Body{currentPassword, newPassword, confirmation}credentials/+server.ts—GET: Listet Credentials vonGET /realms/{realm}/account/credentials(TOTP-Status, registrierte Passkeys)credentials/totp/+server.ts—GET: Holt TOTP-Setup-Daten (BASE32-Secret, QR-Code-URL) vonGET /realms/{realm}/account/credentials/totpcredentials/totp/+server.ts—POST: Schliesst TOTP-Registrierung ab (POST /realms/{realm}/account/credentials/totpmit{secret, code})credentials/[id]/+server.ts—DELETE: Credential entfernen (DELETE /realms/{realm}/account/credentials/{id})credentials/[id]/+server.ts—PUT:userLabelaktualisieren (PUT /realms/{realm}/account/credentials/{id}mit{userLabel})credentials/passkey/register/+server.ts—POST: WebAuthn-Passkey-Registrierung initiieren + abschliessenNeue Hilfsfunktion in
frontend/src/lib/server/auth.ts:callKeycloakAccountApi(token, method, path, body?)— generischer Proxy zu Keycloak (analogtryRefreshToken)Neue npm-Abhaengigkeit:
qrcodezum Rendern des TOTP-QR-Codes (Check: mit Projekt-Konventionen kompatibel)2. UI — Account-Sicherheitseinstellungen (
frontend/src/routes/app/account/+page.svelte)Folgende Cards werden unterhalb der bestehenden eingefuegt:
a) Passwort aendern
POST /api/auth/change-passwordb) 2FA / TOTP
$state()), nie gecached/persistiertc) Passkeys (WebAuthn)
navigator.credentials.create()→ BFF schliesst ab3. i18n (
frontend/src/lib/i18n/{de,en}/account.json)security.heading— "Sicherheit"security.passwordund Sub-Keyssecurity.twoFactorund Sub-Keyssecurity.passkeyund Sub-Keys4. i18n-Store erweitern (
frontend/src/lib/stores/i18n.svelte.ts)Technische Hinweise
POST /realms/{realm}/account/password,GET /realms/{realm}/account/credentials, etc.Referenzen
Umsetzung abgeschlossen in Commit
7588b3c: