Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change x509 dependency #142

Merged
merged 1 commit into from
Jan 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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