authenticate: apply branding to sign out pages (#5044)

Add support for the Enterprise branding options to the sign_out and
signed_out page handlers.
This commit is contained in:
Kenneth Jenkins 2024-04-01 11:32:29 -07:00 committed by GitHub
parent 40655e491a
commit e8edb465f4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 67 additions and 6 deletions

View file

@ -89,7 +89,7 @@ func (a *Authenticate) mountDashboard(r *mux.Router) {
// routes that don't need a session:
sr.Path("/sign_out").Handler(httputil.HandlerFunc(a.SignOut))
sr.Path("/signed_out").Handler(handlers.SignedOut(handlers.SignedOutData{})).Methods(http.MethodGet)
sr.Path("/signed_out").Handler(httputil.HandlerFunc(a.signedOut)).Methods(http.MethodGet)
// routes that need a session:
sr = sr.NewRoute().Subrouter()
@ -186,7 +186,8 @@ func (a *Authenticate) SignOut(w http.ResponseWriter, r *http.Request) error {
}
handlers.SignOutConfirm(handlers.SignOutConfirmData{
URL: urlutil.SignOutURL(r, authenticateURL, a.state.Load().sharedKey),
URL: urlutil.SignOutURL(r, authenticateURL, a.state.Load().sharedKey),
BrandingOptions: a.options.Load().BrandingOptions,
}).ServeHTTP(w, r)
return nil
}
@ -240,6 +241,13 @@ func (a *Authenticate) signOutRedirect(w http.ResponseWriter, r *http.Request) e
return nil
}
func (a *Authenticate) signedOut(w http.ResponseWriter, r *http.Request) error {
handlers.SignedOut(handlers.SignedOutData{
BrandingOptions: a.options.Load().BrandingOptions,
}).ServeHTTP(w, r)
return nil
}
// reauthenticateOrFail starts the authenticate process by redirecting the
// user to their respective identity provider. This function also builds the
// 'state' parameter which is encrypted and includes authenticating data