Tracking issue for sub-phase 1.d of RFC-001.
Replace the dev-mode X-User-Id header from 1.b with real JWT verification against the JWKS exposed by waveflow-web/Better Auth (1.c). End-to-end authenticated requests from web → server.
Scope
waveflow-server side:
jsonwebtoken crate for verification.
- JWKS fetcher with TTL cache (1h, configurable). Background refresh loop.
- axum extractor
AuthenticatedUser that:
- Pulls
Authorization: Bearer <token> header.
- Verifies signature against cached JWKS.
- Validates
exp, iat, iss, aud.
- Extracts
sub (= user_id UUID) and scope claims.
- All CRUD endpoints from 1.b switched from
X-User-Id to AuthenticatedUser.
- Graceful 401 response with
WWW-Authenticate: Bearer header.
waveflow-web side:
- Server-side fetch helper that auto-includes the JWT from the active session.
- Refresh token flow: when a 401 hits, transparently refresh and retry once.
JWKS rotation runbook (deliverable)
- Cache TTL = 1h.
- Keys rotate quarterly.
- Overlap window = 1 week (old + new keys both valid).
- Documented in
docs/operations/jwks-rotation.md (new file in waveflow-server).
Dependencies
- Blocks on: 1.b (CRUD endpoints exist) + 1.c (JWKS endpoint live).
Acceptance criteria
Estimate
~2 weeks.
Tracking issue for sub-phase 1.d of RFC-001.
Replace the dev-mode
X-User-Idheader from 1.b with real JWT verification against the JWKS exposed bywaveflow-web/Better Auth (1.c). End-to-end authenticated requests from web → server.Scope
waveflow-serverside:jsonwebtokencrate for verification.AuthenticatedUserthat:Authorization: Bearer <token>header.exp,iat,iss,aud.sub(=user_idUUID) andscopeclaims.X-User-IdtoAuthenticatedUser.WWW-Authenticate: Bearerheader.waveflow-webside:JWKS rotation runbook (deliverable)
docs/operations/jwks-rotation.md(new file inwaveflow-server).Dependencies
Acceptance criteria
curl -H \"Authorization: Bearer <jwt>\" http://server/profilesreturns 200; without header returns 401.Bearer error=\"invalid_token\".Estimate
~2 weeks.