How to use the xmldom.DOMSerializer function in xmldom

To help you get started, we’ve selected a few xmldom examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github socialtables / saml-protocol / lib / response-construction.js View on Github external
}},
				constructAssertion(sp, idp, inResponseTo, nameID, attributes, now, destinationURL)
			]
		})
		.end();

	// encrypt if necessary
	if (sp.requireEncryptedResponses || idp.encryptAllResponses) {
		const encryptCredential = credentials.getCredentialsFromEntity(sp, "encryption")[0];
		if (!encryptCredential) {
			throw new errors.ProtocolError("Unable to encrypt assertion; no credential provided");
		}
		// re-parse with xmldom, encrypt (not fast, but not heinous), serialize
		const doc = new xmldom.DOMParser().parseFromString(xml);
		encryption.encryptAssertion(doc, encryptCredential);
		xml = new xmldom.DOMSerializer().serializeToString(doc);
	}

	return Promise.resolve(xml);
}

xmldom

A pure JavaScript W3C standard-based (XML DOM Level 2 Core) DOMParser and XMLSerializer module.

MIT
Latest version published 3 years ago

Package Health Score

64 / 100
Full package analysis