From 31878e5f6d18326771ca2b928e99d25c2aab9389 Mon Sep 17 00:00:00 2001 From: Sanil Chawla Date: Fri, 9 Mar 2018 09:15:06 -0800 Subject: [PATCH 1/4] Fixes TypeError in validation --- packages/meteor-accounts-saml/saml_utils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/meteor-accounts-saml/saml_utils.js b/packages/meteor-accounts-saml/saml_utils.js index 092122623d462..74468ad7f5b83 100644 --- a/packages/meteor-accounts-saml/saml_utils.js +++ b/packages/meteor-accounts-saml/saml_utils.js @@ -413,7 +413,7 @@ SAML.prototype.validateResponse = function(samlResponse, relayState, callback) { } } - if (!profile.email && profile.nameID && profile.nameIDFormat && profile.nameIDFormat.indexOf('emailAddress') >= 0) { + if (!profile.email && profile.nameID && profile.nameIDFormat && profile.nameIDFormat.value.indexOf('emailAddress') >= 0) { profile.email = profile.nameID; } if (Meteor.settings.debug) { From 120381d141d15fa438ea8d1413d39b1556f7e0d3 Mon Sep 17 00:00:00 2001 From: Sanil Chawla Date: Fri, 9 Mar 2018 09:16:21 -0800 Subject: [PATCH 2/4] Adds '.value' to fix TypeError in SAML validation --- packages/meteor-accounts-saml/saml_server.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/meteor-accounts-saml/saml_server.js b/packages/meteor-accounts-saml/saml_server.js index 2a293e4c0cd85..c944797d303e7 100644 --- a/packages/meteor-accounts-saml/saml_server.js +++ b/packages/meteor-accounts-saml/saml_server.js @@ -333,7 +333,7 @@ const middleware = function(req, res, next) { throw new Error(`Unable to validate response url: ${ err }`); } - const credentialToken = profile.inResponseToId || profile.InResponseTo || samlObject.credentialToken; + const credentialToken = profile.inResponseToId.value || profile.InResponseTo || samlObject.credentialToken; if (!credentialToken) { // No credentialToken in IdP-initiated SSO const saml_idp_credentialToken = Random.id(); From 548f21e1d7f7feee5ec70ce198fada5ce605aef5 Mon Sep 17 00:00:00 2001 From: Rodrigo Nascimento Date: Thu, 5 Apr 2018 14:16:25 -0300 Subject: [PATCH 3/4] Update saml_server.js --- packages/meteor-accounts-saml/saml_server.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/meteor-accounts-saml/saml_server.js b/packages/meteor-accounts-saml/saml_server.js index c944797d303e7..067bbb765a7ff 100644 --- a/packages/meteor-accounts-saml/saml_server.js +++ b/packages/meteor-accounts-saml/saml_server.js @@ -333,7 +333,7 @@ const middleware = function(req, res, next) { throw new Error(`Unable to validate response url: ${ err }`); } - const credentialToken = profile.inResponseToId.value || profile.InResponseTo || samlObject.credentialToken; + const credentialToken = (profile.inResponseToId && profile.inResponseToId.value) || profile.inResponseToId || profile.InResponseTo || samlObject.credentialToken; if (!credentialToken) { // No credentialToken in IdP-initiated SSO const saml_idp_credentialToken = Random.id(); From 0a57ba4deb172c6ebed33083eed00a3abd025e40 Mon Sep 17 00:00:00 2001 From: Rodrigo Nascimento Date: Thu, 5 Apr 2018 14:20:22 -0300 Subject: [PATCH 4/4] Update saml_utils.js --- packages/meteor-accounts-saml/saml_utils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/meteor-accounts-saml/saml_utils.js b/packages/meteor-accounts-saml/saml_utils.js index 74468ad7f5b83..30eec18b57ba1 100644 --- a/packages/meteor-accounts-saml/saml_utils.js +++ b/packages/meteor-accounts-saml/saml_utils.js @@ -413,7 +413,7 @@ SAML.prototype.validateResponse = function(samlResponse, relayState, callback) { } } - if (!profile.email && profile.nameID && profile.nameIDFormat && profile.nameIDFormat.value.indexOf('emailAddress') >= 0) { + if (!profile.email && profile.nameID && (profile.nameIDFormat && profile.nameIDFormat.value != null ? profile.nameIDFormat.value : profile.nameIDFormat).indexOf('emailAddress') >= 0) { profile.email = profile.nameID; } if (Meteor.settings.debug) {