feat(dev): mock OIDC OP can authenticate for the local dev stack (LC-577) #549
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/lc577-mock-oidc-auth"
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?
What
Gives
dev/mock-oidc.pya real, self-contained authorization-code flow sojust dev-web-local-mockcan complete a login end to end. Every authenticated page (home dashboard, room view,/settings, thread/details panels) now renders and is screenshot-verifiable without standing up the full bunyip dev-sso stack.Attribution
The implementation is @vas2000-work's commit (
feat(dev): make the mock OIDC OP able to actually authenticate), cherry-picked onto current main with authorship preserved. It applied cleanly (the two files' bases were identical to main). I verified it end to end against current main and opened this PR.How it works (no server changes)
/jwks.json(samekid). Fixed rather than per-process because the server caches JWKS at boot; a random key would invalidate that cache on every mock restart and force an app restart in lockstep.GET /authorize: no login form or consent (it is a stub); mints a single-use code and 302s straight back toredirect_uriwith the caller'sstate, retaining thenonce.POST /token: exchanges the code for an EdDSA-signedid_tokencarryingiss/aud/sub/email/preferred_username/iat/expand the retainednonce.GET /userinfo: serves the same identity, so the callback'suserinfo.sub == id_token.subconsistency check passes.S256is accepted but not verified (local-dev stub, not a conformance target).MOCK_SSO_SUB/EMAIL/USERNAME), so the same account is reused across boots.python:3-alpine->python:3-slimsopyjwt[crypto]/cryptographyland as glibc wheels instead of compiling against musl. The mock port is published and the overlay documents thechrome --host-resolver-rules="MAP mock-oidc 127.0.0.1"rule so one issuer string stays valid for both the server (compose DNS) and a host browser.The server's OIDC path is untouched and fully exercised: the id_token is really signed and really verified. No dev bypass was added to the shipped binary.
Verification (live, against current main)
Booted
just dev-web-local-mockand completed a real login via headless chrome with the documented resolver rule:devuseron the home dashboard./settingsrenders (Profile: usernamedevuser, roleuser, emaildev@example.test).#generalroom and posted a message as the same identity (via a curl cookie jar,--resolve mock-oidc:9000:127.0.0.1); the room composes correctly with the sidebar, the active-row glyph, and the right-hand Details panel.dev/mock-oidc.py+ the compose overlay; login succeeded against the untouched OIDC path).Stack torn down cleanly; the separate long-chat dev-web stack was unaffected.
Acceptance criteria
just dev-web-local-mockboots; visiting/and completing the SSO redirect lands on an authenticated session./settings, and the home dashboard all render for that session.sub).dev/mock-oidc.pyand the overlay keep their LOCAL-DEV-ONLY warnings, updated to reflect that login now works.Closes LC-577.
🤖 Generated with Claude Code
https://claude.ai/code/session_01GJbJChgMXj7m1Q8GdnTPyT