fix(auth): chain session middleware before auth gate to prevent redirect loop
This commit is contained in:
parent
3ccaada226
commit
c89f823cb6
1 changed files with 5 additions and 4 deletions
|
|
@ -116,10 +116,11 @@ func main() {
|
||||||
})
|
})
|
||||||
|
|
||||||
// --- Workspace launcher (public, but OIDC-protected) ---
|
// --- Workspace launcher (public, but OIDC-protected) ---
|
||||||
sessionMiddleware := sessionStore.SessionMiddleware
|
// Chain: SessionMiddleware (reads cookie → sets context) → AuthGate (checks context → redirects if needed)
|
||||||
authGate := oidcHandler.AuthGateMiddleware
|
combinedAuth := func(next http.Handler) http.Handler {
|
||||||
uiHandler.RegisterRoutes(mux, authGate)
|
return sessionStore.SessionMiddleware(oidcHandler.AuthGateMiddleware(next))
|
||||||
_ = sessionMiddleware // Used for session-aware middleware in future
|
}
|
||||||
|
uiHandler.RegisterRoutes(mux, combinedAuth)
|
||||||
|
|
||||||
// --- Admin routes (protected by bearer token) ---
|
// --- Admin routes (protected by bearer token) ---
|
||||||
adminAuth := admin.TokenAuthMiddleware(cfg.Admin.SecretToken)
|
adminAuth := admin.TokenAuthMiddleware(cfg.Admin.SecretToken)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue