From 023899a1da3752875dc47e2f6a8d66da3260d39d Mon Sep 17 00:00:00 2001 From: Yamil Asusta Date: Mon, 14 Dec 2020 12:49:34 -0400 Subject: [PATCH] Change x509 dependency --- lib/passport-wsfed-saml2/saml.js | 6 +++--- package.json | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/passport-wsfed-saml2/saml.js b/lib/passport-wsfed-saml2/saml.js index b05a534..2e2f8bd 100644 --- a/lib/passport-wsfed-saml2/saml.js +++ b/lib/passport-wsfed-saml2/saml.js @@ -4,7 +4,7 @@ var crypto = require('crypto'); var xpath = require('xpath'); var xmlCrypto = require('xml-crypto'); var EventEmitter = require('events'); -const x509 = require('x509'); +const forge = require('node-forge'); const utils = require('./utils'); var ELEMENT_NODE = 1; @@ -134,12 +134,12 @@ SAML.prototype.extractAndValidateCertExpiration = function (validatedSamlAsserti if (!cert) { return false; } - const parsedCert = x509.parseCert(utils.certToPEM(cert)); + const parsedCert = forge.pki.certificateFromPem(utils.certToPEM(cert)); const nowDate = new Date(); // true if current date is before expiry AND after cert start date - if ( ! (nowDate > parsedCert.notBefore && nowDate < parsedCert.notAfter)) { + if ( ! (nowDate > parsedCert.validity.notBefore && nowDate < parsedCert.validity.notAfter)) { this.eventEmitter.emit('certificateExpirationValidationFailed', {}); return false; } diff --git a/package.json b/package.json index f12c35e..b18ac96 100644 --- a/package.json +++ b/package.json @@ -21,10 +21,10 @@ "dependencies": { "ejs": "2.5.5", "jsonwebtoken": "~5.0.4", + "node-forge": "^0.10.0", "passport-strategy": "^1.0.0", "uid2": "0.0.x", "valid-url": "^1.0.9", - "x509": "^0.3.4", "xml-crypto": "auth0/xml-crypto#v1.4.1-auth0.2", "xml-encryption": "auth0/node-xml-encryption#v0.12.0", "xml2js": "0.1.x", @@ -46,7 +46,7 @@ "wsfed": "~0.3.5" }, "engines": { - "node": ">= 4" + "node": ">= 10" }, "licenses": [ {