v1.1.4: fix fetching bug
This commit is contained in:
parent
cfe814ebb0
commit
0f0d0807a0
|
@ -1,12 +1,16 @@
|
|||
'use strict';
|
||||
|
||||
var keyfetch = require('./keyfetch.js');
|
||||
var testUrl = "https://example.auth0.com";
|
||||
|
||||
keyfetch.init({});
|
||||
keyfetch.oidcJwks("https://bigsquid.auth0.com").then(function (jwks) {
|
||||
keyfetch.oidcJwks().then(function (jwks) {
|
||||
keyfetch._clear();
|
||||
console.log(jwks);
|
||||
return keyfetch.oidcJwk(jwks[0].thumbprint, "https://bigsquid.auth0.com").then(function (jwk) {
|
||||
console.log(jwk);
|
||||
return keyfetch.oidcJwk(jwks[0].thumbprint, "https://example.auth0.com").then(function () {
|
||||
return keyfetch.oidcJwk(jwks[0].thumbprint, "https://example.auth0.com").then(function (jwk) {
|
||||
console.log(jwk);
|
||||
});
|
||||
});
|
||||
}).catch(function (err) {
|
||||
console.error(err);
|
||||
|
|
|
@ -22,6 +22,9 @@ function checkMinDefaultMax(opts, key, n, d, x) {
|
|||
}
|
||||
}
|
||||
|
||||
keyfetch._clear = function () {
|
||||
keyCache = {};
|
||||
};
|
||||
keyfetch.init = function (opts) {
|
||||
mincache = checkMinDefaultMax(opts, 'mincache',
|
||||
1 * 60,
|
||||
|
@ -113,7 +116,7 @@ keyfetch.oidcJwks = function (iss) {
|
|||
};
|
||||
function checkId(id) {
|
||||
return function (results) {
|
||||
var result = results.some(function (result) {
|
||||
var result = results.filter(function (result) {
|
||||
// we already checked iss above
|
||||
return result.jwk.kid === id || result.thumbprint === id;
|
||||
})[0];
|
||||
|
|
|
@ -10,9 +10,7 @@
|
|||
},
|
||||
"deprecated": false,
|
||||
"description": "Lightweight support for fetching JWKs.",
|
||||
"files": [
|
||||
"keyfetch-test.js"
|
||||
],
|
||||
"files": [],
|
||||
"keywords": [
|
||||
"jwks",
|
||||
"jwk",
|
||||
|
@ -31,5 +29,5 @@
|
|||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"version": "1.1.3"
|
||||
"version": "1.1.4"
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue