You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 3, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Nov 3, 2026. It is now read-only.
[Feature] Allow Node elements to be used as AttributeValue #97
Today I used patch-package to patch saml@3.0.1 for the project I'm working on.
I needed to add some Node elements with specific attributes as AttributeValue in order to create a certain assertion and the current version only allows for textContent to be used. Here is the diff that solved my problem:
diff --git a/node_modules/saml/lib/saml20.js b/node_modules/saml/lib/saml20.js
index 9db8141..1ff00f4 100644
--- a/node_modules/saml/lib/saml20.js+++ b/node_modules/saml/lib/saml20.js@@ -216,7 +216,11 @@ function createAssertion(options, strategies, callback) {
// Ignore undefined values in Array
var valueElement = doc.createElementNS(NAMESPACE, 'saml:AttributeValue');
valueElement.setAttribute('xsi:type', options.typedAttributes ? getAttributeType(value) : 'xs:anyType');
- valueElement.textContent = value;+ if ('nodeType' in Object(value)) {+ valueElement.appendChild(value);+ } else {+ valueElement.textContent = value;+ }
attributeElement.appendChild(valueElement);
}
});
Activity
madaster97 commentedon Mar 26, 2025
This was really helpful for me today. PS, this is what you then need to pass into the
attributesoption: