Resolve invalid state parameter issue.

This commit is contained in:
2024-10-03 14:00:42 +01:00
parent e9e1fccf5e
commit b1c0fc5583
2 changed files with 8 additions and 1 deletions
+7
View File
@@ -261,6 +261,13 @@ func (t *TraefikOidc) ServeHTTP(rw http.ResponseWriter, req *http.Request) {
http.Redirect(rw, req, originalPath, http.StatusFound)
return
}
if !authSuccess && originalPath == "invalid-state-param" {
// redirect to the root path so that the user can try again
// this usually happens when user was previously authenticated
// and the session was cleared, but user tries to refresh the page
// and different traefik instance is used.
http.Redirect(rw, req, "/", http.StatusFound)
}
http.Error(rw, "Authentication failed", http.StatusUnauthorized)
return
}