mirror of
https://github.com/nais/wonderwall.git
synced 2026-05-06 16:36:51 +00:00
feat(handler): local logout redirects back to preconfigured URL
This commit is contained in:
@@ -248,7 +248,6 @@ func (s *Standalone) logout(w http.ResponseWriter, r *http.Request, globalLogout
|
||||
}
|
||||
|
||||
logger.Info("logout: successful local logout")
|
||||
metrics.ObserveLogout(metrics.LogoutOperationLocal)
|
||||
}
|
||||
|
||||
cookie.Clear(w, cookie.Session, s.GetCookieOptions(r))
|
||||
@@ -257,6 +256,12 @@ func (s *Standalone) logout(w http.ResponseWriter, r *http.Request, globalLogout
|
||||
logger.Debug("logout: redirecting to identity provider for global/single-logout")
|
||||
metrics.ObserveLogout(metrics.LogoutOperationSelfInitiated)
|
||||
http.Redirect(w, r, logout.SingleLogoutURL(idToken), http.StatusTemporaryRedirect)
|
||||
} else {
|
||||
redirect := s.Client.LogoutCallback(r).PostLogoutRedirectURI()
|
||||
|
||||
logger.Debugf("logout: redirecting to %s", redirect)
|
||||
metrics.ObserveLogout(metrics.LogoutOperationLocal)
|
||||
http.Redirect(w, r, redirect, http.StatusTemporaryRedirect)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -537,7 +537,8 @@ func localLogout(t *testing.T, rpClient *http.Client, idp *mock.IdentityProvider
|
||||
assert.NoError(t, err)
|
||||
|
||||
resp := get(t, rpClient, logoutURL.String())
|
||||
assert.Equal(t, http.StatusOK, resp.StatusCode)
|
||||
assert.Equal(t, http.StatusTemporaryRedirect, resp.StatusCode)
|
||||
assert.Equal(t, idp.Cfg.OpenID.PostLogoutRedirectURI, resp.Location.String())
|
||||
|
||||
cookies := rpClient.Jar.Cookies(logoutURL)
|
||||
sessionCookie := getCookieFromJar(cookie.Session, cookies)
|
||||
|
||||
Reference in New Issue
Block a user