mirror of
https://github.com/hanzoai/node-jwks-rsa.git
synced 2026-09-24 17:00:54 +00:00
+13
-1
@@ -1,6 +1,18 @@
|
||||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
## [1.3.0] - (2018-06-20)
|
||||
|
||||
**Added**
|
||||
- Adding support for hapi 17.x.x [\#38](https://github.com/auth0/node-jwks-rsa/pull/38) ([degrammer](https://github.com/degrammer))
|
||||
|
||||
**Fixed**
|
||||
- Fixing wrong error message [\#41](https://github.com/auth0/node-jwks-rsa/pull/41) ([adematte](https://github.com/adematte))
|
||||
|
||||
## [1.2.1] - 2017-10-19
|
||||
|
||||
### Changed
|
||||
|
||||
- Fixed TypeScript definition
|
||||
|
||||
## [1.2.0] - 2017-06-27
|
||||
|
||||
|
||||
@@ -22,6 +22,11 @@ server.register(jwt, (err) => {
|
||||
complete: true,
|
||||
|
||||
// Dynamically provide a signing key based on the kid in the header and the singing keys provided by the JWKS endpoint.
|
||||
|
||||
/* If you're using Hapi 17.x.x you have to use version 8.x.x of hapi-auth-jwt2
|
||||
(https://github.com/dwyl/hapi-auth-jwt2#compatibility) and use the promise based version jwksRsa.hapiJwt2KeyAsync instead of jwksRsa.hapiJwt2Key
|
||||
*/
|
||||
|
||||
key: jwksRsa.hapiJwt2Key({
|
||||
cache: true,
|
||||
rateLimit: true,
|
||||
|
||||
Vendored
+8
-2
@@ -31,9 +31,15 @@ declare module 'jwks-rsa' {
|
||||
handleSigningKeyError?(err: Error, cb: (err: Error) => void): any;
|
||||
}
|
||||
|
||||
function ExpressJwtSecret(options: JwksRsa.Options): ExpressJwt.SecretCallback;
|
||||
function expressJwtSecret(options: JwksRsa.Options): ExpressJwt.SecretCallback;
|
||||
|
||||
function HapiJwt2Key(options: JwksRsa.Options): (name: string, scheme: string, options?: any) => void;
|
||||
function hapiJwt2Key(options: JwksRsa.Options): (name: string, scheme: string, options?: any) => void;
|
||||
|
||||
function hapiJwt2KeyAsync(options: JwksRsa.Options): (name: string, scheme: string, options?: any) => void;
|
||||
|
||||
function koaJwtSecret(options: JwksRsa.Options): (name: string, scheme: string, options?: any) => void;
|
||||
|
||||
function passportJwtSecret(options: JwksRsa.Options): ExpressJwt.SecretCallback;
|
||||
|
||||
class ArgumentError extends Error {
|
||||
constructor(message: string);
|
||||
|
||||
Generated
+4732
File diff suppressed because it is too large
Load Diff
+11
-11
@@ -5,12 +5,12 @@
|
||||
"main": "lib/index.js",
|
||||
"types": "index.d.ts",
|
||||
"dependencies": {
|
||||
"@types/express-jwt": "0.0.34",
|
||||
"debug": "^2.2.0",
|
||||
"limiter": "^1.1.0",
|
||||
"lru-memoizer": "^1.6.0",
|
||||
"ms": "^2.0.0",
|
||||
"request": "^2.73.0"
|
||||
"@types/express-jwt": "0.0.40",
|
||||
"debug": "^3.1.0",
|
||||
"limiter": "^1.1.3",
|
||||
"lru-memoizer": "^1.12.0",
|
||||
"ms": "^2.1.1",
|
||||
"request": "^2.87.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"babel-cli": "^6.9.0",
|
||||
@@ -22,14 +22,14 @@
|
||||
"eslint": "^2.10.2",
|
||||
"eslint-plugin-babel": "^3.2.0",
|
||||
"express": "^4.16.2",
|
||||
"express-jwt": "^3.4.0",
|
||||
"jsonwebtoken": "^7.1.7",
|
||||
"express-jwt": "^5.3.1",
|
||||
"jsonwebtoken": "^8.3.0",
|
||||
"koa": "^2.2.0",
|
||||
"koa-jwt": "^3.2.0",
|
||||
"mocha": "^2.5.3",
|
||||
"nock": "^8.0.0",
|
||||
"nock": "^9.4.1",
|
||||
"passport": "^0.4.0",
|
||||
"passport-jwt": "^3.0.0",
|
||||
"passport-jwt": "^4.0.0",
|
||||
"rimraf": "^2.5.2",
|
||||
"supertest": "^3.0.0"
|
||||
},
|
||||
@@ -39,7 +39,7 @@
|
||||
"prepublish": "npm run clean && npm run compile",
|
||||
"test": "NODE_ENV=test mocha --compilers js:babel-core/register --timeout 5000 $(find ./tests -name *.tests.js)",
|
||||
"test-watch": "NODE_ENV=test mocha --compilers js:babel-core/register --timeout 5000 $(find ./tests -name *.tests.js) --watch",
|
||||
"release": "git tag $npm_package_version && git push && git push --tags && npm publish"
|
||||
"release": "git tag $npm_package_version && git push && git push --tags && npm publish --access public"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
||||
+2
-1
@@ -1,7 +1,7 @@
|
||||
import { JwksClient } from './JwksClient';
|
||||
|
||||
import * as errors from './errors';
|
||||
import { hapiJwt2Key } from './integrations/hapi';
|
||||
import { hapiJwt2Key, hapiJwt2KeyAsync } from './integrations/hapi';
|
||||
import { expressJwtSecret } from './integrations/express';
|
||||
import { koaJwtSecret } from './integrations/koa';
|
||||
import { passportJwtSecret } from './integrations/passport';
|
||||
@@ -17,5 +17,6 @@ module.exports.SigningKeyNotFoundError = errors.SigningKeyNotFoundError;
|
||||
|
||||
module.exports.expressJwtSecret = expressJwtSecret;
|
||||
module.exports.hapiJwt2Key = hapiJwt2Key;
|
||||
module.exports.hapiJwt2KeyAsync = hapiJwt2KeyAsync;
|
||||
module.exports.koaJwtSecret = koaJwtSecret;
|
||||
module.exports.passportJwtSecret = passportJwtSecret;
|
||||
|
||||
@@ -13,9 +13,26 @@ const handleSigningKeyError = (err, cb) => {
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Call hapiJwt2Key as a Promise
|
||||
* @param {object} options
|
||||
* @returns {Promise}
|
||||
*/
|
||||
module.exports.hapiJwt2KeyAsync = (options) => {
|
||||
const secretProvider = module.exports.hapiJwt2Key(options);
|
||||
return function(decoded) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const cb = (err, key) => {
|
||||
(!key || err) ? reject(err) : resolve({ key });
|
||||
};
|
||||
secretProvider(decoded, cb);
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
module.exports.hapiJwt2Key = (options) => {
|
||||
if (options === null || options === undefined) {
|
||||
throw new ArgumentError('An options object must be provided when initializing expressJwtSecret');
|
||||
throw new ArgumentError('An options object must be provided when initializing hapiJwt2Key');
|
||||
}
|
||||
|
||||
const client = new JwksClient(options);
|
||||
|
||||
Reference in New Issue
Block a user