Comparing version 0.7.0 to 0.8.0
@@ -471,4 +471,6 @@ // Generated by CoffeeScript 1.7.1 | ||
parse_authn_response = function(saml_response, sp_private_key, idp_certificates, cb) { | ||
var decrypted_assertion, user; | ||
parse_authn_response = function() { | ||
var allow_unencrypted, cb, decrypted_assertion, idp_certificates, saml_response, sp_private_key, user, _i; | ||
saml_response = arguments[0], sp_private_key = arguments[1], idp_certificates = arguments[2], allow_unencrypted = 5 <= arguments.length ? __slice.call(arguments, 3, _i = arguments.length - 1) : (_i = 3, []), cb = arguments[_i++]; | ||
allow_unencrypted = allow_unencrypted[0]; | ||
user = {}; | ||
@@ -478,3 +480,16 @@ decrypted_assertion = null; | ||
function(cb_wf) { | ||
return decrypt_assertion(saml_response, sp_private_key, cb_wf); | ||
return decrypt_assertion(saml_response, sp_private_key, function(err, result) { | ||
var assertion; | ||
if (err == null) { | ||
return cb_wf(null, result); | ||
} | ||
if (!allow_unencrypted) { | ||
return cb_wf(err, result); | ||
} | ||
assertion = saml_response.getElementsByTagNameNS(XMLNS.SAML, 'Assertion'); | ||
if (assertion.length !== 1) { | ||
return cb_wf(new Error("Expected 1 Assertion or 1 EncryptedAssertion; found " + assertion.length)); | ||
} | ||
return cb_wf(null, assertion[0].toString()); | ||
}); | ||
}, function(result, cb_wf) { | ||
@@ -561,4 +576,5 @@ debug(result); | ||
ServiceProvider.prototype.assert = function() { | ||
var cb, decrypted_assertion, get_request, identity_provider, request_body, response, saml_response, _i; | ||
var cb, decrypted_assertion, get_request, identity_provider, options, request_body, response, saml_response, _i; | ||
identity_provider = arguments[0], request_body = arguments[1], get_request = 4 <= arguments.length ? __slice.call(arguments, 2, _i = arguments.length - 1) : (_i = 2, []), cb = arguments[_i++]; | ||
options = get_request[1]; | ||
get_request = get_request[0]; | ||
@@ -596,3 +612,3 @@ if (!(((request_body != null ? request_body.SAMLResponse : void 0) != null) || ((request_body != null ? request_body.SAMLRequest : void 0) != null))) { | ||
response.type = 'authn_response'; | ||
return parse_authn_response(saml_response, _this.private_key, identity_provider.certificates, cb_wf); | ||
return parse_authn_response(saml_response, _this.private_key, identity_provider.certificates, options != null ? options.allow_unencrypted_assertion : void 0, cb_wf); | ||
case saml_response.getElementsByTagNameNS(XMLNS.SAMLP, 'LogoutResponse').length !== 1: | ||
@@ -599,0 +615,0 @@ if (!check_status_success(saml_response)) { |
{ | ||
"name": "saml2-js", | ||
"version": "0.7.0", | ||
"version": "0.8.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
86608
655