From e8670d7c25087e7e480e0fe34419b07d173a7398 Mon Sep 17 00:00:00 2001 From: Ruben de Vries Date: Fri, 17 May 2024 11:58:47 +0200 Subject: [PATCH] fix login form being submitted to /sso instead of /login --- identity_provider.go | 1 + samlidp/samlidp.go | 3 +++ samlidp/session.go | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/identity_provider.go b/identity_provider.go index abaaad68..d4cf5a04 100644 --- a/identity_provider.go +++ b/identity_provider.go @@ -101,6 +101,7 @@ type IdentityProvider struct { Intermediates []*x509.Certificate MetadataURL url.URL SSOURL url.URL + LoginURL url.URL LogoutURL url.URL ServiceProviderProvider ServiceProviderProvider SessionProvider SessionProvider diff --git a/samlidp/samlidp.go b/samlidp/samlidp.go index 13ca10b9..9fdbd912 100644 --- a/samlidp/samlidp.go +++ b/samlidp/samlidp.go @@ -51,6 +51,8 @@ func New(opts Options) (*Server, error) { metadataURL.Path += "/metadata" ssoURL := opts.URL ssoURL.Path += "/sso" + loginURL := opts.URL + loginURL.Path += "/login" logr := opts.Logger if logr == nil { logr = logger.DefaultLogger @@ -65,6 +67,7 @@ func New(opts Options) (*Server, error) { Certificate: opts.Certificate, MetadataURL: metadataURL, SSOURL: ssoURL, + LoginURL: loginURL, }, logger: logr, Store: opts.Store, diff --git a/samlidp/session.go b/samlidp/session.go index 8ffae2ba..6dae2886 100644 --- a/samlidp/session.go +++ b/samlidp/session.go @@ -122,7 +122,7 @@ func (s *Server) sendLoginForm(w http.ResponseWriter, _ *http.Request, req *saml RelayState string }{ Toast: toast, - URL: req.IDP.SSOURL.String(), + URL: req.IDP.LoginURL.String(), SAMLRequest: base64.StdEncoding.EncodeToString(req.RequestBuffer), RelayState: req.RelayState, }