Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: auth0/node-jsonwebtoken
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v7.1.7
Choose a base ref
...
head repository: auth0/node-jsonwebtoken
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v7.1.8
Choose a head ref
  • 5 commits
  • 4 files changed
  • 2 contributors

Commits on Jul 29, 2016

  1. update changelog

    jfromaniello committed Jul 29, 2016
    Copy the full SHA
    5117aac View commit details

Commits on Aug 10, 2016

  1. Removing unnecessary extra decoding. jwtString is already verified as…

    … valid and signature checked
    Mircea Danila Dumitrescu committed Aug 10, 2016
    Copy the full SHA
    55d5834 View commit details
  2. Fixed tests, however typ: 'JWT' should not be in the options at all, …

    …so please review other tests
    Mircea Danila Dumitrescu committed Aug 10, 2016
    Copy the full SHA
    01903bc View commit details
  3. Copy the full SHA
    d66d4eb View commit details
  4. 7.1.8

    jfromaniello committed Aug 10, 2016
    Copy the full SHA
    51c4fef View commit details
Showing with 11 additions and 13 deletions.
  1. +4 −0 CHANGELOG.md
  2. +1 −1 package.json
  3. +5 −5 test/verify.tests.js
  4. +1 −7 verify.js
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -4,6 +4,10 @@
All notable changes to this project will be documented in this file starting from version **v4.0.0**.
This project adheres to [Semantic Versioning](http://semver.org/).

## 7.1.7 - 2016-07-29

- Use lodash.once instead of unlicensed/unmaintained cb ([3ac95ad93ef3068a64e03d8d14deff231b1ed529](https://github.com/auth0/node-jsonwebtoken/commit/3ac95ad93ef3068a64e03d8d14deff231b1ed529))

## 7.1.6 - 2016-07-15

- fix issue with buffer payload. closes #216 ([6b50ff324b4dfd2cb0e49b666f14a6672d015b22](https://github.com/auth0/node-jsonwebtoken/commit/6b50ff324b4dfd2cb0e49b666f14a6672d015b22)), closes [#216](https://github.com/auth0/node-jsonwebtoken/issues/216)
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jsonwebtoken",
"version": "7.1.7",
"version": "7.1.8",
"description": "JSON Web Token implementation (symmetric and asymmetric)",
"main": "index.js",
"scripts": {
10 changes: 5 additions & 5 deletions test/verify.tests.js
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@ describe('verify', function() {
var priv = fs.readFileSync(path.join(__dirname, 'priv.pem'));

it('should first assume JSON claim set', function (done) {
var header = { alg: 'RS256' };
var header = { typ: 'JWT', alg: 'RS256' };
var payload = { iat: Math.floor(Date.now() / 1000 ) };

var signed = jws.sign({
@@ -21,15 +21,15 @@ describe('verify', function() {
encoding: 'utf8'
});

jwt.verify(signed, pub, {typ: 'JWT'}, function(err, p) {
jwt.verify(signed, pub, function(err, p) {
assert.isNull(err);
assert.deepEqual(p, payload);
done();
});
});

it('should be able to validate unsigned token', function (done) {
var header = { alg: 'none' };
var header = { typ: 'JWT', alg: 'none' };
var payload = { iat: Math.floor(Date.now() / 1000 ) };

var signed = jws.sign({
@@ -39,7 +39,7 @@ describe('verify', function() {
encoding: 'utf8'
});

jwt.verify(signed, null, {typ: 'JWT'}, function(err, p) {
jwt.verify(signed, null, function(err, p) {
assert.isNull(err);
assert.deepEqual(p, payload);
done();
@@ -93,7 +93,7 @@ describe('verify', function() {

it('should not error on expired token within clockTolerance interval', function (done) {
clock = sinon.useFakeTimers(1437018584000);
var options = {algorithms: ['HS256'], clockTolerance: 100}
var options = {algorithms: ['HS256'], clockTolerance: 100};

jwt.verify(token, key, options, function (err, p) {
assert.isNull(err);
8 changes: 1 addition & 7 deletions verify.js
Original file line number Diff line number Diff line change
@@ -96,13 +96,7 @@ module.exports = function (jwtString, secretOrPublicKey, options, callback) {
if (!valid)
return done(new JsonWebTokenError('invalid signature'));

var payload;

try {
payload = decode(jwtString);
} catch(err) {
return done(err);
}
var payload=decodedToken.payload;

if (typeof payload.nbf !== 'undefined' && !options.ignoreNotBefore) {
if (typeof payload.nbf !== 'number') {