mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-23 02:41:50 +03:00
Updated tests to reflect jwks-rsa v2 changes
refs https://github.com/auth0/node-jwks-rsa/blob/master/CHANGELOG.md#200---2021-03-01 - `jwks-rsa` switches from callbacks to async-await and so we need to change the tests to reflect this - this commit moves from `getSigningKey` containing a callback to it being part of the async-await flow
This commit is contained in:
parent
7c7f46cbf1
commit
d01d8988e2
@ -16,11 +16,10 @@ const verifyJWKS = (endpoint, token) => {
|
||||
jwksUri: endpoint
|
||||
});
|
||||
|
||||
function getKey(header, callback){
|
||||
client.getSigningKey(header.kid, (err, key) => {
|
||||
let signingKey = key.publicKey || key.rsaPublicKey;
|
||||
callback(null, signingKey);
|
||||
});
|
||||
async function getKey(header, callback) {
|
||||
const key = await client.getSigningKey(header.kid);
|
||||
let signingKey = key.publicKey || key.rsaPublicKey;
|
||||
callback(null, signingKey);
|
||||
}
|
||||
|
||||
jwt.verify(token, getKey, {}, (err, decoded) => {
|
||||
|
@ -16,11 +16,10 @@ const verifyJWKS = (endpoint, token) => {
|
||||
jwksUri: endpoint
|
||||
});
|
||||
|
||||
function getKey(header, callback){
|
||||
client.getSigningKey(header.kid, (err, key) => {
|
||||
let signingKey = key.publicKey || key.rsaPublicKey;
|
||||
callback(null, signingKey);
|
||||
});
|
||||
async function getKey(header, callback) {
|
||||
const key = await client.getSigningKey(header.kid);
|
||||
let signingKey = key.publicKey || key.rsaPublicKey;
|
||||
callback(null, signingKey);
|
||||
}
|
||||
|
||||
jwt.verify(token, getKey, {}, (err, decoded) => {
|
||||
|
Loading…
Reference in New Issue
Block a user