Comparing version 1.8.1 to 1.9.0
@@ -252,3 +252,3 @@ // Generated by CoffeeScript 1.7.1 | ||
doc = (new xmldom.DOMParser()).parseFromString(xml); | ||
signature = xmlcrypto.xpath(doc, ".//*[local-name(.)='Signature' and namespace-uri(.)='http://www.w3.org/2000/09/xmldsig#']"); | ||
signature = xmlcrypto.xpath(doc, "./*[local-name(.)='Signature' and namespace-uri(.)='http://www.w3.org/2000/09/xmldsig#']"); | ||
if (signature.length !== 1) { | ||
@@ -562,3 +562,3 @@ return null; | ||
add_namespaces_to_child_assertions = function(xml_string) { | ||
var assertion_element, assertion_elements, doc, inclusive_namespaces, new_attribute, ns, prefix_list, response_element, response_elements, _i, _len, _ref; | ||
var assertion_element, assertion_elements, attr, doc, inclusive_namespaces, namespaces, new_attribute, ns, prefixList, response_element, response_elements, _i, _len, _ref; | ||
doc = new xmldom.DOMParser().parseFromString(xml_string); | ||
@@ -575,16 +575,29 @@ response_elements = doc.getElementsByTagNameNS(XMLNS.SAMLP, 'Response'); | ||
assertion_element = assertion_elements[0]; | ||
if (assertion_element.getElementsByTagNameNS(XMLNS.DS, 'Signature').length === 0) { | ||
return xml_string; | ||
} | ||
inclusive_namespaces = assertion_element.getElementsByTagNameNS(XMLNS.EXC_C14N, 'InclusiveNamespaces')[0]; | ||
if (!inclusive_namespaces) { | ||
return xml_string; | ||
} | ||
prefix_list = inclusive_namespaces.getAttribute('PrefixList'); | ||
_ref = prefix_list.split(' '); | ||
for (_i = 0, _len = _ref.length; _i < _len; _i++) { | ||
ns = _ref[_i]; | ||
if (response_element.getAttribute('xmlns:' + ns) && !assertion_element.getAttribute('xmlns:' + ns)) { | ||
new_attribute = doc.createAttribute('xmlns:' + ns); | ||
new_attribute.value = response_element.getAttribute('xmlns:' + ns); | ||
namespaces = inclusive_namespaces && (prefixList = (_ref = inclusive_namespaces.getAttribute('PrefixList')) != null ? _ref.trim() : void 0) ? (function() { | ||
var _i, _len, _ref1, _results; | ||
_ref1 = prefixList.split(' '); | ||
_results = []; | ||
for (_i = 0, _len = _ref1.length; _i < _len; _i++) { | ||
ns = _ref1[_i]; | ||
_results.push("xmlns:" + ns); | ||
} | ||
return _results; | ||
})() : (function() { | ||
var _i, _len, _ref1, _results; | ||
_ref1 = response_element.attributes; | ||
_results = []; | ||
for (_i = 0, _len = _ref1.length; _i < _len; _i++) { | ||
attr = _ref1[_i]; | ||
if (attr.name.match(/^xmlns:/)) { | ||
_results.push(attr.name); | ||
} | ||
} | ||
return _results; | ||
})(); | ||
for (_i = 0, _len = namespaces.length; _i < _len; _i++) { | ||
ns = namespaces[_i]; | ||
if (response_element.getAttribute(ns) && !assertion_element.getAttribute(ns)) { | ||
new_attribute = doc.createAttribute(ns); | ||
new_attribute.value = response_element.getAttribute(ns); | ||
assertion_element.setAttributeNode(new_attribute); | ||
@@ -905,4 +918,5 @@ } | ||
module.exports.parse_assertion_attributes = parse_assertion_attributes; | ||
module.exports.add_namespaces_to_child_assertions = add_namespaces_to_child_assertions; | ||
module.exports.set_option_defaults = set_option_defaults; | ||
module.exports.extract_certificate_data = extract_certificate_data; | ||
} |
{ | ||
"name": "saml2-js", | ||
"version": "1.8.1", | ||
"version": "1.9.0", | ||
"description": "SAML 2.0 node helpers", | ||
@@ -5,0 +5,0 @@ "author": "Clever", |
Sorry, the diff of this file is not supported yet
156606
35
868