From 983e16f877c75ad1db9a6dc42dae1b5b883cb77c Mon Sep 17 00:00:00 2001 From: Caleb Doxsey Date: Tue, 23 Aug 2022 13:18:29 -0600 Subject: [PATCH] authenticate: fix branding for webauthn device registration page --- authenticate/handlers.go | 1 + authenticate/handlers/webauthn/webauthn.go | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/authenticate/handlers.go b/authenticate/handlers.go index 894742760..f3b7721ed 100644 --- a/authenticate/handlers.go +++ b/authenticate/handlers.go @@ -744,6 +744,7 @@ func (a *Authenticate) getWebauthnState(ctx context.Context) (*webauthn.State, e SessionState: ss, SessionStore: state.sessionStore, RelyingParty: state.webauthnRelyingParty, + BrandingOptions: a.options.Load().BrandingOptions, }, nil } diff --git a/authenticate/handlers/webauthn/webauthn.go b/authenticate/handlers/webauthn/webauthn.go index ceee6bd17..d29b69ddc 100644 --- a/authenticate/handlers/webauthn/webauthn.go +++ b/authenticate/handlers/webauthn/webauthn.go @@ -55,6 +55,7 @@ type State struct { SessionState *sessions.State SessionStore sessions.SessionStore SharedKey []byte + BrandingOptions httputil.BrandingOptions } // A StateProvider provides state for the handler. @@ -398,11 +399,13 @@ func (h *Handler) handleView(w http.ResponseWriter, r *http.Request, state *Stat return err } - return ui.ServePage(w, r, "WebAuthnRegistration", map[string]interface{}{ + m := map[string]interface{}{ "creationOptions": creationOptions, "requestOptions": requestOptions, "selfUrl": r.URL.String(), - }) + } + httputil.AddBrandingOptionsToMap(m, state.BrandingOptions) + return ui.ServePage(w, r, "WebAuthnRegistration", m) } func (h *Handler) saveSessionAndRedirect(w http.ResponseWriter, r *http.Request, state *State, rawRedirectURI string) error {