fix(e2e): capture bearer from ANY host, not just /api/v1 #108
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/e2e-capture-bearer-any-host"
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?
Summary
CI diagnostic dump confirmed setup runs cleanly through SPA login (TOTP entered, OIDC callback succeeded, SPA landed on
/dashboard) but the bearer-capture filter onurl.includes('/api/v1/')rejected every observed request.The SPA fires
https://api.a8n.systems/v1/auth/membershipsagainst the bunyip hub BEFORE any mokosh-server/api/v1call. That membership request carries the bunyip-issued at+jwt asAuthorization: Bearer, so the token IS available - the filter just skipped it.Mokosh-server runs the bunyip-RS verifier (
src/modules/auth/middleware.rs:69) and JIT-mirrors(sub, email)into localuserson first use, so the SAME bearer authenticates both bunyip and mokosh PSA endpoints. Capture the first bearer seen on any URL; it works against both backends.Also: log the URL the token was captured from on success so the next failure tells us at a glance whether the token came from bunyip, mokosh, or somewhere unexpected.
Test plan
[setup] captured bearer from https://api.a8n.systems/...and proceeds; api project tests run against mokosh/api/v1/*with the same bearer.CI dump showed setup running cleanly through login (TOTP entered, OIDC callback succeeded, SPA landed on /dashboard) but the bearer-capture filter rejected every observed request. The SPA fired `/v1/auth/memberships` against the bunyip hub (api.a8n.systems) BEFORE any mokosh-server /api/v1 call. The membership request DID carry the bunyip-issued at+jwt as `Authorization: Bearer`, but the old filter on `url.includes('/api/v1/')` skipped it. Mokosh-server runs the bunyip-RS verifier (src/modules/auth/middleware.rs:69) and JIT-mirrors (sub, email) into local `users` on first sight, so the same bearer authenticates both the bunyip hub AND the mokosh PSA API. Capture the FIRST bearer seen on any URL; it works against both. While here, log the URL the token was captured from on success - on the next failure we can confirm at a glance whether it came from bunyip, mokosh, or somewhere else. #PMS-140