From a8ed2baad5902d149ae9d8f4586b3547a3f2d4a9 Mon Sep 17 00:00:00 2001 From: Nickie Pucel Date: Fri, 26 Mar 2021 09:24:57 -0700 Subject: [PATCH] Fix unit tests --- test/tests.spec.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/test/tests.spec.ts b/test/tests.spec.ts index d45d311b7..26e327df8 100644 --- a/test/tests.spec.ts +++ b/test/tests.spec.ts @@ -1663,16 +1663,17 @@ describe("passport-saml /", function () { 'https://app.onelogin.com/saml/metadata/371755' + 'https://app.onelogin.com/saml/metadata/371755DCnPTQYBb1hKspbe6fg1U3q8xn4=e0+aFomA0+JAY0f9tKqzIuqIVSSw7LiFUsneEDKPBWdiTz1sMdgr/2y1e9+rjaS2mRmCi/vSQLY3zTYz0hp6nJNU19+TWoXo9kHQyWT4KkeQL4Xs/gZ/AoKC20iHVKtpPps0IQ0Ml/qRoouSitt6Sf/WDz2LV/pWcH2hx5tv3xSw36hK2NQc7qw7r1mEXnvcjXReYo8rrVf7XHGGxNoRIEICUIi110uvsWemSXf0Z0dyb0FVYOWuSsQMDlzNpheADBifFO4UTfSEhFZvn8kVCGZUIwrbOhZ2d/+YEtgyuTg+qtslgfy4dwd4TvEcfuRzQTazeefprSFyiQckAXOjcw==' + TEST_CERT + - 'ploer@subspacesw.com{audience}urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport' + + 'ploer@subspacesw.com{audience}urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport' + ""; const base64xml = Buffer.from(xml).toString("base64"); const container = { SAMLResponse: base64xml }; // Set the maxAssertionAgeMs so that IssueInstant + maxAssertionAgeMs == 2014-05-28T00:16:09Z - // Note that no NotOnOrAfter attribute is specified in this response + // Note that NotOnOrAfter == 2015-05-28T00:19:08Z in the response const samlObj = new SAML({ ...samlConfig, maxAssertionAgeMs: 1000 }); - // Fake the current date to be after the time limit set by maxAssertionAgeMs + // Fake the current date to be after the time limit set by maxAssertionAgeMs, + // but before the limit set by NotOnOrAfter fakeClock.restore(); fakeClock = sinon.useFakeTimers(Date.parse("2014-05-28T00:17:09Z")); await assert.rejects(samlObj.validatePostResponseAsync(container), { @@ -1685,13 +1686,13 @@ describe("passport-saml /", function () { 'https://app.onelogin.com/saml/metadata/371755' + 'https://app.onelogin.com/saml/metadata/371755DCnPTQYBb1hKspbe6fg1U3q8xn4=e0+aFomA0+JAY0f9tKqzIuqIVSSw7LiFUsneEDKPBWdiTz1sMdgr/2y1e9+rjaS2mRmCi/vSQLY3zTYz0hp6nJNU19+TWoXo9kHQyWT4KkeQL4Xs/gZ/AoKC20iHVKtpPps0IQ0Ml/qRoouSitt6Sf/WDz2LV/pWcH2hx5tv3xSw36hK2NQc7qw7r1mEXnvcjXReYo8rrVf7XHGGxNoRIEICUIi110uvsWemSXf0Z0dyb0FVYOWuSsQMDlzNpheADBifFO4UTfSEhFZvn8kVCGZUIwrbOhZ2d/+YEtgyuTg+qtslgfy4dwd4TvEcfuRzQTazeefprSFyiQckAXOjcw==' + TEST_CERT + - 'ploer@subspacesw.com{audience}urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport' + + 'ploer@subspacesw.com{audience}urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport' + ""; const base64xml = Buffer.from(xml).toString("base64"); const container = { SAMLResponse: base64xml }; // Set the maxAssertionAgeMs so that IssueInstant + maxAssertionAgeMs == 2014-05-28T00:16:09Z - // Note that no NotOnOrAfter attribute is specified in this response + // Note that NotOnOrAfter == 2015-05-28T00:19:08Z in the response const samlObj = new SAML({ ...samlConfig, maxAssertionAgeMs: 1000 }); // Fake the current date to be before the time limit set by maxAssertionAgeMs