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

can skip validate the expiration #88

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions 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.
Expand Down
6 changes: 5 additions & 1 deletion index.js
Expand Up @@ -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){
Expand All @@ -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));
}

Expand Down
2 changes: 1 addition & 1 deletion 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"
Expand Down