diff --git a/CHANGELOG.md b/CHANGELOG.md index f5f58ae..d98047b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # nJwt Change Log +### 1.2.1 + +* Added support for skip validate the expiration of the token, use `nJwt.createVerifier().setIgnoreExpiration(true)` + ### 1.2.0 * [#84] (https://github.com/jwtk/njwt/pull/84) Resolves `uuid` vulnerability. diff --git a/index.js b/index.js index 4de537b..82ff472 100644 --- a/index.js +++ b/index.js @@ -338,6 +338,10 @@ Verifier.prototype.setSigningKey = function setSigningKey(keyStr) { Verifier.prototype.setKeyResolver = function setKeyResolver(keyResolver) { this.keyResolver = keyResolver.bind(this); }; +Verifier.prototype.setIgnoreExpiration = function setIgnoreExpiration(ignoreExpiration) { + this.ignoreExpiration = ignoreExpiration; + return this; +}; Verifier.prototype.isSupportedAlg = isSupportedAlg; Verifier.prototype.verify = function verify(jwtString,cb){ @@ -362,7 +366,7 @@ Verifier.prototype.verify = function verify(jwtString,cb){ return done(new JwtParseError(properties.errors.SIGNATURE_ALGORITHM_MISMTACH,jwtString,header,body)); } - if (jwt.isExpired()) { + if (!this.ignoreExpiration && jwt.isExpired()) { return done(new JwtParseError(properties.errors.EXPIRED,jwtString,header,body)); } diff --git a/package.json b/package.json index 52a40a6..d22339a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "njwt", - "version": "1.2.0", + "version": "1.2.1", "description": "JWT Library for Node.js", "engines": { "node": ">=6.0"