express-jwt
Advanced tools
Comparing version 0.1.2 to 0.1.3
function UnauthorizedError (code, error) { | ||
Error.call(this, error.message); | ||
this.name = "UnauthorizedError"; | ||
this.message = error.message; | ||
@@ -4,0 +5,0 @@ this.code = code; |
@@ -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 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8159
145
68
1