Fix SSO return-to redirect loop
SetReturnToCookie stored /sso/redirect as the return-to path, causing a redirect loop after successful SSO login: the callback would redirect back to /sso/redirect instead of /. Filter all /sso/* paths, not just /sso/callback. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -229,7 +229,7 @@ func ValidateStateCookie(w http.ResponseWriter, r *http.Request, prefix, querySt
|
||||
// redirect back to it after SSO login completes.
|
||||
func SetReturnToCookie(w http.ResponseWriter, r *http.Request, prefix string) {
|
||||
path := r.URL.Path
|
||||
if path == "" || path == "/login" || path == "/sso/callback" {
|
||||
if path == "" || path == "/login" || strings.HasPrefix(path, "/sso/") {
|
||||
path = "/"
|
||||
}
|
||||
http.SetCookie(w, &http.Cookie{
|
||||
|
||||
Reference in New Issue
Block a user