Comparing version 7.0.0 to 7.1.0
{ | ||
"name": "get-jwks", | ||
"version": "7.0.0", | ||
"version": "7.1.0", | ||
"description": "Fetch utils for JWKS keys", | ||
@@ -48,5 +48,5 @@ "main": "src/get-jwks.js", | ||
"tap": "^16.0.0", | ||
"tsd": "^0.21.0", | ||
"tsd": "^0.22.0", | ||
"typescript": "^4.5.5" | ||
} | ||
} |
@@ -123,3 +123,5 @@ 'use strict' | ||
const jwk = body.keys.find( | ||
key => (key.alg === undefined || key.alg === alg) && key.kid === kid | ||
key => | ||
(alg === undefined || key.alg === undefined || key.alg === alg) && | ||
key.kid === kid | ||
) | ||
@@ -126,0 +128,0 @@ |
@@ -78,2 +78,16 @@ 'use strict' | ||
t.test( | ||
'returns a jwk if no alg is provided and kid match but jwk has alg', | ||
async t => { | ||
nock(domain).get('/.well-known/jwks.json').reply(200, jwks) | ||
const getJwks = buildGetJwks() | ||
const key = jwks.keys[1] | ||
const jwk = await getJwks.getJwk({ domain, kid: key.kid }) | ||
t.ok(jwk) | ||
t.same(jwk, key) | ||
} | ||
) | ||
t.test('caches a successful response', async t => { | ||
@@ -80,0 +94,0 @@ nock(domain).get('/.well-known/jwks.json').once().reply(200, jwks) |
@@ -57,14 +57,32 @@ 'use strict' | ||
t.test('returns a jwk if no alg is provided and kid match for discovery', async t => { | ||
nock(domain).get('/.well-known/openid-configuration').reply(200, oidcConfig) | ||
nock(domain).get('/.well-known/certs').reply(200, jwks) | ||
const getJwks = buildGetJwks({ providerDiscovery: true }) | ||
const key = jwks.keys[2] | ||
t.test( | ||
'returns a jwk if no alg is provided and kid match for discovery', | ||
async t => { | ||
nock(domain).get('/.well-known/openid-configuration').reply(200, oidcConfig) | ||
nock(domain).get('/.well-known/certs').reply(200, jwks) | ||
const getJwks = buildGetJwks({ providerDiscovery: true }) | ||
const key = jwks.keys[2] | ||
const jwk = await getJwks.getJwk({ domain, kid: key.kid }) | ||
const jwk = await getJwks.getJwk({ domain, kid: key.kid }) | ||
t.ok(jwk) | ||
t.same(jwk, key) | ||
}) | ||
t.ok(jwk) | ||
t.same(jwk, key) | ||
} | ||
) | ||
t.test( | ||
'returns a jwk if no alg is provided and kid match for discovery but jwk has alg', | ||
async t => { | ||
nock(domain).get('/.well-known/openid-configuration').reply(200, oidcConfig) | ||
nock(domain).get('/.well-known/certs').reply(200, jwks) | ||
const getJwks = buildGetJwks({ providerDiscovery: true }) | ||
const key = jwks.keys[1] | ||
const jwk = await getJwks.getJwk({ domain, kid: key.kid }) | ||
t.ok(jwk) | ||
t.same(jwk, key) | ||
} | ||
) | ||
t.test('caches a successful response for discovery', async t => { | ||
@@ -71,0 +89,0 @@ nock(domain).get('/.well-known/openid-configuration').reply(200, oidcConfig) |
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
48807
905