feat: Keycloak OIDC auth — protect write operations #22
Labels
No labels
domain:backend
domain:devops
domain:frontend
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
forgejo_admin/pal-e-docs-app#22
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?
Lineage
plan-pal-e-docs→ Phase F5 (phase-pal-e-docs-frontend-auth)Repo
forgejo_admin/pal-e-appUser Story
As a platform operator
I want write operations to require Keycloak authentication
So that unauthenticated users cannot create or modify notes via the frontend
Context
pal-e-app now has write capability (Quick-Jot, PR #21) but zero authentication. Anyone on the tailnet can create notes. Keycloak is deployed at
https://keycloak.tail5b443a.ts.netand the OIDC flow is proven in westside-app (Auth.js + Keycloak provider, PR #9).Architecture: read-only operations (browse, search, dashboard, boards) remain public. Only write operations (
POST /api/notes) require authentication. The FAB button should only appear for authenticated users.Keycloak realm:
master(same as westside-app). Need a newpal-e-appclient registered.Reference implementation:
~/westside-app/src/auth.ts+~/westside-app/src/hooks.server.tsFile Targets
Files to create:
src/auth.ts— Auth.js config with Keycloak providersrc/hooks.server.ts— SvelteKit hooks for session handlingsrc/routes/signin/+page.svelte— sign-in pagesrc/routes/signout/+page.svelte— sign-out pagek8s/pal-e-auth-secrets.enc.yaml— SOPS-encrypted client secretFiles to modify:
src/routes/+layout.svelte— show user/sign-out when authenticated, sign-in when not; hide FAB when not authenticatedsrc/routes/+layout.server.ts— pass session to layoutsrc/routes/api/notes/+server.ts— require auth for POSTpackage.json— add@auth/sveltekitdependencyFiles NOT to touch:
src/routes/search/— read-only, stays publicsrc/routes/dashboard/— read-only, stays publicsrc/routes/boards/— read-only (board moves already have their own proxy)Acceptance Criteria
Test Expectations
Constraints
age15ct78fr4scv4vxzj3k6q76wshywzlu0mdc64a624e264dst7zfaq6tjzjr)AUTH_SECRETenv var needed for Auth.js session encryptionhttps://keycloak.tail5b443a.ts.net/realms/masterChecklist
Closes #20Related
phase-pal-e-docs-frontend-auth— plan phaseplan-pal-e-docs— parent plan