Comparing version 1.6.0 to 1.7.0
// Generated by CoffeeScript 1.7.1 | ||
var IdentityProvider, SAMLError, ServiceProvider, XMLNS, async, certificate_to_keyinfo, check_saml_signature, check_status_success, create_authn_request, create_logout_request, create_logout_response, create_metadata, crypto, debug, decrypt_assertion, extract_certificate_data, format_pem, get_name_id, get_session_index, get_signed_data, get_status, parseString, parse_assertion_attributes, parse_authn_response, parse_logout_request, parse_response_header, pretty_assertion_attributes, set_option_defaults, sign_request, to_error, url, util, xmlbuilder, xmlcrypto, xmldom, xmlenc, zlib, _, | ||
var IdentityProvider, SAMLError, ServiceProvider, XMLNS, add_namespaces_to_child_assertions, async, certificate_to_keyinfo, check_saml_signature, check_status_success, create_authn_request, create_logout_request, create_logout_response, create_metadata, crypto, debug, decrypt_assertion, extract_certificate_data, format_pem, get_name_id, get_session_index, get_signed_data, get_status, parseString, parse_assertion_attributes, parse_authn_response, parse_logout_request, parse_response_header, pretty_assertion_attributes, set_option_defaults, sign_request, to_error, url, util, xmlbuilder, xmlcrypto, xmldom, xmlenc, zlib, _, | ||
__hasProp = {}.hasOwnProperty, | ||
@@ -37,3 +37,4 @@ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, | ||
DS: 'http://www.w3.org/2000/09/xmldsig#', | ||
XENC: 'http://www.w3.org/2001/04/xmlenc#' | ||
XENC: 'http://www.w3.org/2001/04/xmlenc#', | ||
EXC_C14N: 'http://www.w3.org/2001/10/xml-exc-c14n#' | ||
}; | ||
@@ -553,2 +554,35 @@ | ||
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; | ||
doc = new xmldom.DOMParser().parseFromString(xml_string); | ||
response_elements = doc.getElementsByTagNameNS(XMLNS.SAMLP, 'Response'); | ||
if (response_elements.length !== 1) { | ||
return xml_string; | ||
} | ||
response_element = response_elements[0]; | ||
assertion_elements = response_element.getElementsByTagNameNS(XMLNS.SAML, 'Assertion'); | ||
if (assertion_elements.length !== 1) { | ||
return xml_string; | ||
} | ||
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); | ||
assertion_element.setAttributeNode(new_attribute); | ||
} | ||
} | ||
return new xmldom.XMLSerializer().serializeToString(response_element); | ||
}; | ||
parse_authn_response = function(saml_response, sp_private_keys, idp_certificates, allow_unencrypted, ignore_signature, cb) { | ||
@@ -716,5 +750,6 @@ var user; | ||
return function(response_buffer, cb_wf) { | ||
var err; | ||
var err, saml_response_abnormalized; | ||
debug(saml_response); | ||
saml_response = (new xmldom.DOMParser()).parseFromString(response_buffer.toString()); | ||
saml_response_abnormalized = add_namespaces_to_child_assertions(response_buffer.toString()); | ||
saml_response = (new xmldom.DOMParser()).parseFromString(saml_response_abnormalized); | ||
try { | ||
@@ -721,0 +756,0 @@ response = { |
{ | ||
"name": "saml2-js", | ||
"version": "1.6.0", | ||
"version": "1.7.0", | ||
"description": "SAML 2.0 node helpers", | ||
@@ -5,0 +5,0 @@ "author": "Clever", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
137846
846