Skip to content
This repository has been archived by the owner on Jun 6, 2023. It is now read-only.

Commit

Permalink
Merge pull request #15 from Calpicow/authn_unsign_omit
Browse files Browse the repository at this point in the history
Remove signature related fields when SPSignRequest=false
  • Loading branch information
mbrevoort authored Dec 3, 2016
2 parents 579628d + bc7052d commit 92df338
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 6 additions & 1 deletion authnrequest.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ func (s *ServiceProviderSettings) GetAuthnRequest() *AuthnRequest {
r.Issuer.Url = s.IDPSSODescriptorURL
r.Signature.KeyInfo.X509Data.X509Certificate.Cert = s.PublicCert()

if !s.SPSignRequest {
r.SAMLSIG = ""
r.Signature = nil
}

return r
}

Expand Down Expand Up @@ -146,7 +151,7 @@ func NewAuthnRequest() *AuthnRequest {
Transport: "urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport",
},
},
Signature: Signature{
Signature: &Signature{
XMLName: xml.Name{
Local: "samlsig:Signature",
},
Expand Down
4 changes: 2 additions & 2 deletions types.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ type AuthnRequest struct {
XMLName xml.Name
SAMLP string `xml:"xmlns:samlp,attr"`
SAML string `xml:"xmlns:saml,attr"`
SAMLSIG string `xml:"xmlns:samlsig,attr"`
SAMLSIG string `xml:"xmlns:samlsig,attr,omitempty"`
ID string `xml:"ID,attr"`
Version string `xml:"Version,attr"`
ProtocolBinding string `xml:"ProtocolBinding,attr"`
Expand All @@ -17,7 +17,7 @@ type AuthnRequest struct {
Issuer Issuer `xml:"Issuer"`
NameIDPolicy NameIDPolicy `xml:"NameIDPolicy"`
RequestedAuthnContext RequestedAuthnContext `xml:"RequestedAuthnContext"`
Signature Signature `xml:"Signature,omitempty"`
Signature *Signature `xml:"Signature,omitempty"`
originalString string
}

Expand Down

0 comments on commit 92df338

Please sign in to comment.