fix(oidc): emit redirect full authorize URL to login bridge, not return_to #79
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/oidc-login-bridge-redirect-param"
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
Corrects the OP's side of the SSO login-redirect bridge. The
/oauth2/authorizehandler, onNeedsLogin, redirected to the login UI (bunyip-web) with?return_to=<bare query string>. bunyip-web's login implements the bridge as?redirect=<absolute URL>(bunyip-web/src/handlers/auth_pages.rs): it reads aredirectparam, andsafe_redirectonly accepts a/-relative path or an absolute URL whose origin equals its configured issuer, falling back to/dashboardotherwise. So the OP'sreturn_towas ignored and its bare-query value would have been rejected regardless, stranding the user on the bunyip dashboard instead of completing the round-trip.This emits
?redirect=<issuer>/oauth2/authorize?<serialized request>: correct param name, full absolute URL on the OP issuer's origin that bunyip's allowlist accepts and bounces back to.Scope: PARTIAL FIX (necessary, not sufficient)
This fixes the contract mismatch but does NOT by itself make the federated login complete, because mokosh and bunyip do not share an OP session in the current dev-sso topology:
mokoshdatabase; OP cookie domain.a8n.run.bunyipdatabase and sets host-scopedaccess_token/refresh_tokencookies; it never creates a mokosh OPsidsession.With this change applied in isolation, the post-login bounce to
mokosh-api/oauth2/authorizestill finds no session, re-entersNeedsLogin, and would redirect-loop against bunyip rather than land on the dashboard. Completing the flow needs session federation between the two services (bunyip login proxying into mokosh/v1/auth/login, or mokosh trusting a bunyip-issued token) - out of scope here and tracked separately. First-party SPAs can authenticate directly via/v1/auth/logintoday and skip this bridge entirely.Why merge the partial anyway
The param-name + value-shape mismatch is a genuine latent bug in the bridge contract; fixing it now is a prerequisite for the eventual session-federation work and removes one of the two blockers. It is intentionally not wired into a live flow by this PR.
Verification
cargo fmt -p mokosh-auth-http --check,cargo clippy -p mokosh-auth-http -- -D warnings, andcargo build -p mokosh-auth-httpall clean. No behavior is exercised by an integration test because the round-trip cannot complete until session federation lands; this is a contract-only correction.🤖 Generated with Claude Code
redirectfull authorize URL to login bridge, notreturn_toSuperseded by #113 (Resource Server cutover). Re-analysis: dev-sso was wired with mokosh-server as the OP, but staging already runs bunyip-as-OP (api.a8n.systems serves the live discovery doc; msp-api 404s). This PR patched mokosh-server's own OP login bridge, the wrong layer once bunyip-api is the sole OP. Closing; the fix is the three-repo alignment (#113 here, bunyip #66, mokosh-apps #67).
Pull request closed