azure-ad-verify-token
Advanced tools
Comparing version 1.1.1 to 1.1.2
@@ -5,2 +5,9 @@ # Changelog | ||
### [1.1.2](https://github.com/justinlettau/azure-ad-verify-token/compare/v1.1.1...v1.1.2) (2021-08-27) | ||
### Bug Fixes | ||
* throw error when kid is not present ([#29](https://github.com/justinlettau/azure-ad-verify-token/issues/29)) ([a968886](https://github.com/justinlettau/azure-ad-verify-token/commit/a968886a6bc0ae840c1ef6a32928b312e2f9ff46)) | ||
### [1.1.1](https://github.com/justinlettau/azure-ad-verify-token/compare/v1.1.0...v1.1.1) (2020-11-28) | ||
@@ -7,0 +14,0 @@ |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.clear = exports.removeItem = exports.getItem = exports.setDeferredItem = exports.setItem = void 0; | ||
var config_1 = require("./config"); | ||
@@ -4,0 +5,0 @@ /** |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.resetConfig = exports.getConfig = exports.setConfig = exports.DEFAULT_CACHE_LIFETIME = void 0; | ||
/** | ||
@@ -4,0 +5,0 @@ * Default value for `cacheLifetime`. |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.verify = exports.setConfig = exports.getConfig = void 0; | ||
var config_1 = require("./config"); | ||
exports.getConfig = config_1.getConfig; | ||
exports.setConfig = config_1.setConfig; | ||
Object.defineProperty(exports, "getConfig", { enumerable: true, get: function () { return config_1.getConfig; } }); | ||
Object.defineProperty(exports, "setConfig", { enumerable: true, get: function () { return config_1.setConfig; } }); | ||
var verify_1 = require("./verify"); | ||
exports.verify = verify_1.verify; | ||
Object.defineProperty(exports, "verify", { enumerable: true, get: function () { return verify_1.verify; } }); | ||
//# sourceMappingURL=index.js.map |
@@ -0,1 +1,2 @@ | ||
import jwt from 'jsonwebtoken'; | ||
import { VerifyOptions } from './interfaces'; | ||
@@ -8,2 +9,2 @@ /** | ||
*/ | ||
export declare function verify(token: string, options: VerifyOptions): Promise<string | object>; | ||
export declare function verify(token: string, options: VerifyOptions): Promise<string | jwt.JwtPayload>; |
@@ -6,2 +6,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.verify = void 0; | ||
var jsonwebtoken_1 = __importDefault(require("jsonwebtoken")); | ||
@@ -59,2 +60,5 @@ var node_fetch_1 = __importDefault(require("node-fetch")); | ||
kid = decoded.header.kid; | ||
if (!kid) { | ||
throw new Error('kid missing from token header'); | ||
} | ||
} | ||
@@ -61,0 +65,0 @@ catch (error) { |
{ | ||
"name": "azure-ad-verify-token", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"description": "Verify JWT issued by Azure Active Directory B2C.", | ||
@@ -38,3 +38,3 @@ "keywords": [ | ||
"release": "standard-version", | ||
"format": "prettier --write **/*.{js,ts}" | ||
"format": "prettier --write ." | ||
}, | ||
@@ -48,24 +48,24 @@ "husky": { | ||
"@justinlettau/renovate-config": "^0.1.2", | ||
"@types/jest": "^26.0.15", | ||
"@types/jsonwebtoken": "^8.3.8", | ||
"@types/node-fetch": "^2.5.5", | ||
"@typescript-eslint/eslint-plugin": "^4.8.2", | ||
"@typescript-eslint/parser": "^4.8.2", | ||
"eslint": "^7.14.0", | ||
"eslint-config-prettier": "^6.15.0", | ||
"husky": "^4.2.3", | ||
"jest": "^26.6.3", | ||
"nock": "^12.0.3", | ||
"prettier": "^2.0.2", | ||
"pretty-quick": "^2.0.1", | ||
"standard-version": "^7.1.0", | ||
"ts-jest": "^26.4.4", | ||
"ts-node": "^8.8.1", | ||
"typescript": "^3.8.3" | ||
"@types/jest": "^27.0.1", | ||
"@types/jsonwebtoken": "^8.5.5", | ||
"@types/node-fetch": "^2.5.12", | ||
"@typescript-eslint/eslint-plugin": "^4.29.2", | ||
"@typescript-eslint/parser": "^4.29.2", | ||
"eslint": "^7.32.0", | ||
"eslint-config-prettier": "^8.3.0", | ||
"husky": "^7.0.1", | ||
"jest": "^27.0.6", | ||
"nock": "^13.1.2", | ||
"prettier": "^2.3.2", | ||
"pretty-quick": "^3.1.1", | ||
"standard-version": "^9.3.1", | ||
"ts-jest": "^27.0.5", | ||
"ts-node": "^10.2.1", | ||
"typescript": "^4.3.5" | ||
}, | ||
"dependencies": { | ||
"jsonwebtoken": "^8.5.1", | ||
"node-fetch": "^2.6.0", | ||
"node-fetch": "^2.6.1", | ||
"rsa-pem-from-mod-exp": "^0.8.4" | ||
} | ||
} |
@@ -40,15 +40,17 @@ [![NPM Version](https://badge.fury.io/js/azure-ad-verify-token.svg)](https://badge.fury.io/js/azure-ad-verify-token) | ||
const options: VerifyOptions = { | ||
jwksUri: 'https://contoso.b2clogin.com/contoso.onmicrosoft.com/discovery/v2.0/keys?p=b2c_1_signupsignin1', | ||
issuer: 'https://contoso.b2clogin.com/3285c484-dce5-4abb-a341-bbe4f2bc8554/v2.0/', | ||
audience: '99d1275c-e805-483f-b832-600f8130829c' | ||
jwksUri: | ||
'https://contoso.b2clogin.com/contoso.onmicrosoft.com/discovery/v2.0/keys?p=b2c_1_signupsignin1', | ||
issuer: | ||
'https://contoso.b2clogin.com/3285c484-dce5-4abb-a341-bbe4f2bc8554/v2.0/', | ||
audience: '99d1275c-e805-483f-b832-600f8130829c', | ||
}; | ||
verify(token, options) | ||
.then(decoded => { | ||
.then((decoded) => { | ||
// verified and decoded token | ||
console.log(decoded); | ||
}) | ||
.catch(error => { | ||
.catch((error) => { | ||
// invalid token | ||
console.error(decoded); | ||
console.error(error); | ||
}); | ||
@@ -76,3 +78,3 @@ ``` | ||
setConfig({ | ||
cacheLifetime: 12 * (60 * 60 * 1000) // 12 hours | ||
cacheLifetime: 12 * (60 * 60 * 1000), // 12 hours | ||
}); | ||
@@ -79,0 +81,0 @@ ``` |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
20502
324
99
Updatednode-fetch@^2.6.1