From bfc94143f882fdaf96513f2dab2aa6ea216d1dd2 Mon Sep 17 00:00:00 2001 From: Scott Bishel Date: Tue, 25 Aug 2020 15:32:07 -0600 Subject: [PATCH] update file --- build_request.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/build_request.go b/build_request.go index 41a41a1..4eba224 100644 --- a/build_request.go +++ b/build_request.go @@ -41,9 +41,11 @@ func (sp *SAMLServiceProvider) buildAuthnRequest(includeSig bool) (*etree.Docume authnRequest.CreateElement("saml:Issuer").SetText(sp.IdentityProviderIssuer) } - nameIdPolicy := authnRequest.CreateElement("samlp:NameIDPolicy") - nameIdPolicy.CreateAttr("AllowCreate", "true") - nameIdPolicy.CreateAttr("Format", sp.NameIdFormat) + if sp.NameIdFormat != "" { + nameIdPolicy := authnRequest.CreateElement("samlp:NameIDPolicy") + nameIdPolicy.CreateAttr("AllowCreate", "true") + nameIdPolicy.CreateAttr("Format", sp.NameIdFormat) + } if sp.RequestedAuthnContext != nil { requestedAuthnContext := authnRequest.CreateElement("samlp:RequestedAuthnContext")