saml20-clj
saml20-clj copied to clipboard
saml20-clj.sp.request Coerce/->Element throws [samlp:AuthnRequest: null]
This part is working just fine and returning XML just as it should:
(coerce/->xml-string
[:samlp:AuthnRequest
{:xmlns:samlp "urn:oasis:names:tc:SAML:2.0:protocol"
:ID request-id
:Version "2.0"
:IssueInstant (format-instant instant)
:ProtocolBinding "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"
:ProviderName sp-name
:IsPassive false
:Destination idp-url
:AssertionConsumerServiceURL acs-url}
[:saml:Issuer
{:xmlns:saml "urn:oasis:names:tc:SAML:2.0:assertion"}
issuer]
;;[:samlp:NameIDPolicy {:AllowCreate false :Format saml-format}]
])
XML that it produces looks like this, which looks fine:
<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<samlp:AuthnRequest
AssertionConsumerServiceURL=\"https://www.mydomain.com/saml\"
Destination=\"https://login.microsoftonline.com/rand0m-saml2-ap1-id/saml2\"
ID=\"999888\" IssueInstant=\"111222\"
ProtocolBinding=\"urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST\"
ProviderName=\"MyFancyApp\"
Version=\"2.0\"
xmlns:samlp=\"urn:oasis:names:tc:SAML:2.0:protocol\">
<saml:Issuer xmlns:saml=\"urn:oasis:names:tc:SAML:2.0:assertion\">
https://login.microsoftonline.com/rand0m-saml2-ap1-id/federationmetadata/2007-06/federationmetadata.xml
</saml:Issuer>
</samlp:AuthnRequest>
But coerce/->Element
returns #object[com.sun.org.apache.xerces.internal.dom.DeferredElementNSImpl 0x6db903b4 "[samlp:AuthnRequest: null]"]
which is bad as it should have values from the XML instead of NULL.
(coerce/->Element (coerce/->xml-string
[:samlp:AuthnRequest
{:xmlns:samlp "urn:oasis:names:tc:SAML:2.0:protocol"
:ID request-id
:Version "2.0"
:IssueInstant (format-instant instant)
:ProtocolBinding "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"
:ProviderName sp-name
:IsPassive false
:Destination idp-url
:AssertionConsumerServiceURL acs-url}
[:saml:Issuer
{:xmlns:saml "urn:oasis:names:tc:SAML:2.0:assertion"}
issuer]
;;[:samlp:NameIDPolicy {:AllowCreate false :Format saml-format}]
]))
I was following README guide and this error breaks everything.
Hmmm, that's weird. Did you dig in to this at all? PRs welcome
What version of the lib are you using? We fixed support for non-saml
namespaces in 2.1.0, so this wouldn't have worked in prior versions because the namespace above is samlp
I'm using [metabase/saml20-clj "2.1.0"]
I don't have PR. I was trying to migrate from kirasystems/saml20-clj lib and I was creating a POC.
I hoped for this lib to work out of the box.