express-jwt
Advanced tools
Comparing version 8.2.1 to 8.3.0
@@ -1,2 +0,2 @@ | ||
import * as jwt from 'jsonwebtoken'; | ||
import jwt from 'jsonwebtoken'; | ||
import * as express from 'express'; | ||
@@ -3,0 +3,0 @@ import { unless } from 'express-unless'; |
@@ -38,6 +38,10 @@ "use strict"; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.expressjwt = exports.UnauthorizedError = void 0; | ||
var jwt = require("jsonwebtoken"); | ||
var jsonwebtoken_1 = __importDefault(require("jsonwebtoken")); | ||
var express_unless_1 = require("express-unless"); | ||
var lodash_set_1 = __importDefault(require("lodash.set")); | ||
var UnauthorizedError_1 = require("./errors/UnauthorizedError"); | ||
@@ -79,3 +83,3 @@ var UnauthorizedError_2 = require("./errors/UnauthorizedError"); | ||
if (hasAuthInAccessControl) { | ||
return [2 /*return*/, next()]; | ||
return [2 /*return*/, setImmediate(next)]; | ||
} | ||
@@ -123,3 +127,3 @@ } | ||
try { | ||
decodedToken = jwt.decode(token, { complete: true }); | ||
decodedToken = jsonwebtoken_1.default.decode(token, { complete: true }); | ||
} | ||
@@ -135,3 +139,3 @@ catch (err) { | ||
_b.trys.push([5, 6, , 10]); | ||
jwt.verify(token, key, options); | ||
jsonwebtoken_1.default.verify(token, key, options); | ||
return [3 /*break*/, 10]; | ||
@@ -141,3 +145,3 @@ case 6: | ||
wrappedErr = new UnauthorizedError_1.UnauthorizedError('invalid_token', err_1); | ||
if (!(err_1 instanceof jwt.TokenExpiredError && typeof options.onExpired === 'function')) return [3 /*break*/, 8]; | ||
if (!(err_1 instanceof jsonwebtoken_1.default.TokenExpiredError && typeof options.onExpired === 'function')) return [3 /*break*/, 8]; | ||
return [4 /*yield*/, options.onExpired(req, wrappedErr)]; | ||
@@ -162,8 +166,9 @@ case 7: | ||
request = req; | ||
request[requestProperty] = decodedToken.payload; | ||
next(); | ||
(0, lodash_set_1.default)(request, requestProperty, decodedToken.payload); | ||
setImmediate(next); | ||
return [3 /*break*/, 14]; | ||
case 13: | ||
err_2 = _b.sent(); | ||
return [2 /*return*/, next(err_2)]; | ||
setImmediate(next, err_2); | ||
return [3 /*break*/, 14]; | ||
case 14: return [2 /*return*/]; | ||
@@ -170,0 +175,0 @@ } |
{ | ||
"name": "express-jwt", | ||
"version": "8.2.1", | ||
"version": "8.3.0", | ||
"description": "JWT authentication middleware.", | ||
@@ -38,5 +38,8 @@ "keywords": [ | ||
"express-unless": "^2.1.3", | ||
"jsonwebtoken": "^9.0.0" | ||
"jsonwebtoken": "^9.0.0", | ||
"lodash.set": "^4.3.2" | ||
}, | ||
"devDependencies": { | ||
"@types/lodash": "^4.14.191", | ||
"@types/lodash.set": "^4.3.7", | ||
"@types/mocha": "^9.1.0", | ||
@@ -43,0 +46,0 @@ "@typescript-eslint/eslint-plugin": "^5.15.0", |
@@ -271,3 +271,3 @@ # express-jwt | ||
An `ExpressJwtRequest` type is provided which extends `express.Request` with the `auth` property. | ||
A `Request` type is provided from `express-jwt`, which extends `express.Request` with the `auth` property. It could be aliased, like how `JWTRequest` is below. | ||
@@ -274,0 +274,0 @@ ```typescript |
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
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
27570
311
4
12
+ Addedlodash.set@^4.3.2
+ Addedlodash.set@4.3.2(transitive)