Socket
Socket
Sign inDemoInstall

passport-jwt

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

passport-jwt - npm Package Compare versions

Comparing version 1.1.1 to 1.2.1

12

lib/strategy.js

@@ -23,2 +23,4 @@ var passport = require('passport-strategy')

* authScheme: Expected scheme when JWT can be found in HTTP Authorize header. Default is JWT.
* algorithms: List of strings with the names of the allowed algorithms. For instance, ["HS256", "HS384"].
* ignoreExpiration: if true do not validate the expiration of the token.
* passReqToCallback: If true the, the verify callback will be called with args (request, jwt_payload, done_callback).

@@ -57,2 +59,10 @@ * @param verify - Verify callback with args (jwt_payload, done_callback) if passReqToCallback is false,

if (options.algorithms) {
this._verifOpts.algorithms = options.algorithms;
}
if (options.ignoreExpiration != null) {
this._verifOpts.ignoreExpiration = options.ignoreExpiration;
}
};

@@ -108,3 +118,3 @@ util.inherits(JwtStrategy, passport.Strategy);

}
// Verify the JWT

@@ -111,0 +121,0 @@ JwtStrategy.JwtVerifier(token, this._secretOrKey, this._verifOpts, function(jwt_err, payload) {

2

package.json
{
"name": "passport-jwt",
"version": "1.1.1",
"version": "1.2.1",
"description": "Passport authentication strategy using JSON Web Tokens",

@@ -5,0 +5,0 @@ "main": "./lib",

@@ -31,2 +31,5 @@ # passport-jwt

this value.
* `algorithms`: List of strings with the names of the allowed algorithms. For instance, ["HS256", "HS384"].
* `ignoreExpiration`: if true do not validate the expiration of the token.
* `tokenBodyField`: Field in a request body to search for the jwt.

@@ -33,0 +36,0 @@ Default is auth_token.

@@ -9,3 +9,3 @@ var Strategy = require('../lib/strategy')

describe('calling JWT validation function', function() {
var strategy;
var strategy;

@@ -19,2 +19,4 @@ before(function(done) {

options.secretOrKey = 'secret';
options.algorithms = ["HS256", "HS384"];
options.ignoreExpiration = false;
strategy = new Strategy(options, verifyStub);

@@ -52,3 +54,12 @@

it('should call with the right algorithms option', function() {
expect(Strategy.JwtVerifier.args[0][2]).to.be.an.object;
expect(Strategy.JwtVerifier.args[0][2].algorithms).to.eql(["HS256", "HS384"]);
});
it('should call with the right ignoreExpiration option', function() {
expect(Strategy.JwtVerifier.args[0][2]).to.be.an.object;
expect(Strategy.JwtVerifier.args[0][2].ignoreExpiration).to.be.false;
});
});

@@ -90,3 +101,3 @@

describe('handling failing jwt', function() {
var strategy, info;
var strategy, info;
var verify_spy = sinon.spy();

@@ -128,3 +139,3 @@

describe('handling an invalid authentication header', function() {
var strategy, info;
var strategy, info;
var verify_spy = sinon.spy();

@@ -160,2 +171,2 @@

});
});

@@ -111,3 +111,3 @@ var chai = require('chai')

describe('hanlding a request with a valid jwt and an exception during verification', function() {
describe('handling a request with a valid jwt and an exception during verification', function() {
var strategy, err;

@@ -141,3 +141,3 @@

describe('handing a request with a valid jwt and option passReqToCallback is true', function() {
describe('handling a request with a valid jwt and option passReqToCallback is true', function() {

@@ -144,0 +144,0 @@ var strategy, expected_request, request_arg;

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc