New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

express-jwt

Package Overview
Dependencies
Maintainers
2
Versions
73
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

express-jwt - npm Package Compare versions

Comparing version

to
0.1.3

1

lib/errors/UnauthorizedError.js
function UnauthorizedError (code, error) {
Error.call(this, error.message);
this.name = "UnauthorizedError";
this.message = error.message;

@@ -4,0 +5,0 @@ this.code = code;

14

lib/index.js

@@ -10,7 +10,15 @@ var jwt = require('jsonwebtoken');

if(req.method === 'OPTIONS' && req.headers.hasOwnProperty('access-control-request-headers')) {
if (req.headers['access-control-request-headers'].split(', ').indexOf('authorization') != -1) {
if (req.method === 'OPTIONS' && req.headers.hasOwnProperty('access-control-request-headers')) {
for (var ctrlReqs = req.headers['access-control-request-headers'].split(','),i=0;
i < ctrlReqs.length; i++) {
if (ctrlReqs[i].indexOf('authorization') != -1)
return next();
}
}
if (typeof options.skip !== 'undefined') {
if (options.skip.indexOf(req.url) > -1) {
return next();
}
}
}

@@ -17,0 +25,0 @@ if (req.headers && req.headers.authorization) {

{
"name": "express-jwt",
"version": "0.1.2",
"version": "0.1.3",
"description": "JWT authentication middleware.",

@@ -5,0 +5,0 @@ "keywords": [

@@ -39,2 +39,8 @@ # express-jwt

Optionally you can add paths for the middleware to skip
app.use(jwt({ secret: 'shhhhhhared-secret', skip: ['/token']}));
This is especially useful when applying to multiple routes.
This module also support tokens signed with public/private key pairs. Instead of a secret, you can specify a Buffer with the public key

@@ -41,0 +47,0 @@