mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2026-08-31 08:57:14 +02:00
Fix session handling with oidc login route
This commit is contained in:
@@ -189,7 +189,14 @@ func (s *Server) init() error {
|
|||||||
|
|
||||||
if auth.Keys.OpenIDConfig != nil {
|
if auth.Keys.OpenIDConfig != nil {
|
||||||
openIDConnect := auth.NewOIDC(authHandle)
|
openIDConnect := auth.NewOIDC(authHandle)
|
||||||
openIDConnect.RegisterEndpoints(s.router)
|
// The OIDC callback mutates the session (SaveSession renews the token and
|
||||||
|
// writes the session data), so these routes have to run inside
|
||||||
|
// scs.LoadAndSave just like /login and /logout. Without it the session
|
||||||
|
// is missing from the request context and scs panics.
|
||||||
|
s.router.Group(func(r chi.Router) {
|
||||||
|
r.Use(sessionManager.LoadAndSave)
|
||||||
|
openIDConnect.RegisterEndpoints(r)
|
||||||
|
})
|
||||||
info["hasOpenIDConnect"] = true
|
info["hasOpenIDConnect"] = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user