diff --git a/lib/passport-saml/saml.js b/lib/passport-saml/saml.js index 5ad38484..2ef65955 100644 --- a/lib/passport-saml/saml.js +++ b/lib/passport-saml/saml.js @@ -673,6 +673,7 @@ SAML.prototype.processValidlySignedAssertion = function(xml, inResponseTo, callb } var subject = assertion.Subject; + var subjectConfirmation, confirmData; if (subject) { var nameID = subject[0].NameID; if (nameID) { @@ -685,10 +686,10 @@ SAML.prototype.processValidlySignedAssertion = function(xml, inResponseTo, callb } } - var subjectConfirmation = subject[0].SubjectConfirmation ? - subject[0].SubjectConfirmation[0] : null; - var confirmData = subjectConfirmation && subjectConfirmation.SubjectConfirmationData ? - subjectConfirmation.SubjectConfirmationData[0] : null; + subjectConfirmation = subject[0].SubjectConfirmation ? + subject[0].SubjectConfirmation[0] : null; + confirmData = subjectConfirmation && subjectConfirmation.SubjectConfirmationData ? + subjectConfirmation.SubjectConfirmationData[0] : null; if (subject[0].SubjectConfirmation && subject[0].SubjectConfirmation.length > 1) { msg = 'Unable to process multiple SubjectConfirmations in SAML assertion'; throw new Error(msg);