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) ---
|
||||
sessionMiddleware := sessionStore.SessionMiddleware
|
||||
authGate := oidcHandler.AuthGateMiddleware
|
||||
uiHandler.RegisterRoutes(mux, authGate)
|
||||
_ = sessionMiddleware // Used for session-aware middleware in future
|
||||
// Chain: SessionMiddleware (reads cookie → sets context) → AuthGate (checks context → redirects if needed)
|
||||
combinedAuth := func(next http.Handler) http.Handler {
|
||||
return sessionStore.SessionMiddleware(oidcHandler.AuthGateMiddleware(next))
|
||||
}
|
||||
uiHandler.RegisterRoutes(mux, combinedAuth)
|
||||
|
||||
// --- Admin routes (protected by bearer token) ---
|
||||
adminAuth := admin.TokenAuthMiddleware(cfg.Admin.SecretToken)
|
||||
|
|
|
|||
Loading…
Reference in a new issue