From 4f2bb60adb8ad43e3573a877fe2f0546e5e1a7c8 Mon Sep 17 00:00:00 2001 From: Caleb Doxsey Date: Wed, 24 Feb 2021 11:52:38 -0700 Subject: [PATCH] proxy: redirect to dashboard for logout (#1944) --- proxy/handlers.go | 8 ++++---- proxy/proxy.go | 1 - proxy/state.go | 2 -- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/proxy/handlers.go b/proxy/handlers.go index 9516dc5ef..5f4a8d61f 100644 --- a/proxy/handlers.go +++ b/proxy/handlers.go @@ -65,13 +65,13 @@ func (p *Proxy) SignOut(w http.ResponseWriter, r *http.Request) { redirectURL = uri } - signoutURL := *state.authenticateSignoutURL - q := signoutURL.Query() + dashboardURL := *state.authenticateDashboardURL + q := dashboardURL.Query() q.Set(urlutil.QueryRedirectURI, redirectURL.String()) - signoutURL.RawQuery = q.Encode() + dashboardURL.RawQuery = q.Encode() state.sessionStore.ClearSession(w, r) - httputil.Redirect(w, r, urlutil.NewSignedURL(state.sharedKey, &signoutURL).String(), http.StatusFound) + httputil.Redirect(w, r, urlutil.NewSignedURL(state.sharedKey, &dashboardURL).String(), http.StatusFound) } func (p *Proxy) userInfo(w http.ResponseWriter, r *http.Request) { diff --git a/proxy/proxy.go b/proxy/proxy.go index f8a991d32..9a1edea51 100644 --- a/proxy/proxy.go +++ b/proxy/proxy.go @@ -25,7 +25,6 @@ const ( // authenticate urls dashboardPath = "/.pomerium" signinURL = "/.pomerium/sign_in" - signoutURL = "/.pomerium/sign_out" refreshURL = "/.pomerium/refresh" ) diff --git a/proxy/state.go b/proxy/state.go index dca116d4f..34e76fe15 100644 --- a/proxy/state.go +++ b/proxy/state.go @@ -26,7 +26,6 @@ type proxyState struct { authenticateURL *url.URL authenticateDashboardURL *url.URL authenticateSigninURL *url.URL - authenticateSignoutURL *url.URL authenticateRefreshURL *url.URL encoder encoding.MarshalUnmarshaler @@ -61,7 +60,6 @@ func newProxyStateFromConfig(cfg *config.Config) (*proxyState, error) { state.authenticateURL, _ = urlutil.DeepCopy(cfg.Options.AuthenticateURL) state.authenticateDashboardURL = state.authenticateURL.ResolveReference(&url.URL{Path: dashboardPath}) state.authenticateSigninURL = state.authenticateURL.ResolveReference(&url.URL{Path: signinURL}) - state.authenticateSignoutURL = state.authenticateURL.ResolveReference(&url.URL{Path: signoutURL}) state.authenticateRefreshURL = state.authenticateURL.ResolveReference(&url.URL{Path: refreshURL}) state.sessionStore, err = cookie.NewStore(func() cookie.Options {