From d85eae1dcc8fbb4d0c59e8728aca868cdd1883ba Mon Sep 17 00:00:00 2001 From: Jakub Janczak Date: Wed, 17 Jun 2026 11:46:13 +0200 Subject: [PATCH 1/2] Allow empty TelephoneNumber element in ContactPerson metadata AD FS-generated metadata (e.g. SVEA) emits self-closing elements which fail XS.xpString (xpTextDT requires non-empty text). Switch to XP.xpText0 so empty bodies parse as the empty string. --- SAML2/Metadata/Metadata.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SAML2/Metadata/Metadata.hs b/SAML2/Metadata/Metadata.hs index 0c70974..aadadcd 100644 --- a/SAML2/Metadata/Metadata.hs +++ b/SAML2/Metadata/Metadata.hs @@ -336,7 +336,7 @@ instance XP.XmlPickler Contact where XP.>*< XP.xpOption (xpElem "GivenName" XS.xpString) XP.>*< XP.xpOption (xpElem "SurName" XS.xpString) XP.>*< XP.xpList (xpElem "EmailAddress" XS.xpAnyURI) - XP.>*< XP.xpList (xpElem "TelephoneNumber" XS.xpString)) + XP.>*< XP.xpList (xpElem "TelephoneNumber" XP.xpText0)) data ContactType = ContactTypeTechnical From 9315c164b137eaba0fa275e7e056324c1f17d24b Mon Sep 17 00:00:00 2001 From: Jakub Janczak Date: Wed, 17 Jun 2026 11:58:50 +0200 Subject: [PATCH 2/2] Tolerate empty Company/GivenName/SurName in ContactPerson Same rationale as TelephoneNumber: AD FS-style metadata may emit self-closing string-typed contact children. Use xpText0 so they parse as the empty string instead of failing xpTextDT. --- SAML2/Metadata/Metadata.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/SAML2/Metadata/Metadata.hs b/SAML2/Metadata/Metadata.hs index aadadcd..547dec5 100644 --- a/SAML2/Metadata/Metadata.hs +++ b/SAML2/Metadata/Metadata.hs @@ -332,9 +332,9 @@ instance XP.XmlPickler Contact where XP.>$< (XP.xpAttr "contactType" XP.xpickle XP.>*< XP.xpAnyAttrs XP.>*< XP.xpickle - XP.>*< XP.xpOption (xpElem "Company" XS.xpString) - XP.>*< XP.xpOption (xpElem "GivenName" XS.xpString) - XP.>*< XP.xpOption (xpElem "SurName" XS.xpString) + XP.>*< XP.xpOption (xpElem "Company" XP.xpText0) + XP.>*< XP.xpOption (xpElem "GivenName" XP.xpText0) + XP.>*< XP.xpOption (xpElem "SurName" XP.xpText0) XP.>*< XP.xpList (xpElem "EmailAddress" XS.xpAnyURI) XP.>*< XP.xpList (xpElem "TelephoneNumber" XP.xpText0))