fixup! fixup! fixup! Downgrade gorilla sessions preventing the publishing by traefik hub temporarily.

This commit is contained in:
2024-11-06 14:52:29 +00:00
parent f068d1092e
commit ae456e4e0d
3 changed files with 25 additions and 6 deletions
+15 -3
View File
@@ -385,14 +385,22 @@ func (t *TraefikOidc) handleLogout(rw http.ResponseWriter, req *http.Request) {
return
}
// Build post logout redirect URI if not set
// Build post logout redirect URI with FQDN if not set
if t.postLogoutRedirectURI == "" {
t.postLogoutRedirectURI = buildFullURL(t.scheme, t.determineHost(req), "/")
// Get the host from request headers or direct host
host := t.determineHost(req)
scheme := t.determineScheme(req)
// Build the full URL with scheme and host
t.postLogoutRedirectURI = fmt.Sprintf("%s://%s%s",
scheme,
host,
t.logoutURLPath)
}
// If we have an end session endpoint and an ID token, use OIDC end session
if t.endSessionURL != "" && idToken != "" {
logoutURL, err := BuildLogoutURL(t.endSessionURL, idToken, t.logoutURLPath)
logoutURL, err := BuildLogoutURL(t.endSessionURL, idToken, t.postLogoutRedirectURI)
if err != nil {
handleError(rw, fmt.Sprintf("Failed to build logout URL: %v", err), http.StatusInternalServerError, t.logger)
return
@@ -414,6 +422,10 @@ func BuildLogoutURL(endSessionURL, idToken, postLogoutRedirectURI string) (strin
return "", fmt.Errorf("failed to parse end session URL: %w", err)
}
if postLogoutRedirectURI == "" {
postLogoutRedirectURI = "/"
}
q := u.Query()
q.Set("id_token_hint", idToken)
if postLogoutRedirectURI != "" {