Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Allow Node elements to be used as AttributeValue #97

Open
mandalornl opened this issue Apr 7, 2023 · 0 comments
Open

[Feature] Allow Node elements to be used as AttributeValue #97

mandalornl opened this issue Apr 7, 2023 · 0 comments

Comments

@mandalornl
Copy link

Hi! 馃憢

Firstly, thanks for your work on this project! 馃檪

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);
         }
       });

This issue body was partially generated by patch-package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant