Skip to content

Commit

Permalink
Change x509 dependency (#142)
Browse files Browse the repository at this point in the history
  • Loading branch information
elbuo8 authored Jan 5, 2021
1 parent f7b18e9 commit 881fef8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions lib/passport-wsfed-saml2/saml.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -46,7 +46,7 @@
"wsfed": "~0.3.5"
},
"engines": {
"node": ">= 4"
"node": ">= 10"
},
"licenses": [
{
Expand Down

0 comments on commit 881fef8

Please sign in to comment.