Fix auth handler race condition (#28864)

This commit is contained in:
Michael Geers 2026-04-06 16:18:08 +02:00 • committed by GitHub
parent 529e169f89
commit 3967594b79
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -164,6 +164,11 @@ func logoutHandler(w http.ResponseWriter, r *http.Request) {
func ensureAuthHandler(authObject auth.Auth) mux.MiddlewareFunc {
return func(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if next == nil {
http.Error(w, "Not Found", http.StatusNotFound)
return
}
if authObject.GetAuthMode() == auth.Disabled {
next.ServeHTTP(w, r)
return