Package com.auth0.jwk
Class GuavaCachedJwkProvider
java.lang.Object
com.auth0.jwk.GuavaCachedJwkProvider
- All Implemented Interfaces:
JwkProvider
Jwk provider that caches previously obtained Jwk in memory using a Google Guava cache
-
Constructor Summary
ConstructorsConstructorDescriptionGuavaCachedJwkProvider(JwkProvider provider) Creates a new provider that will cache up to 5 jwks for at most 10 minutesGuavaCachedJwkProvider(JwkProvider provider, long size, long expiresIn, TimeUnit expiresUnit) Creates a new cached provider specifying cache size and ttlGuavaCachedJwkProvider(JwkProvider provider, long size, Duration expiresIn) Creates a new cached provider specifying cache size and ttl -
Method Summary
-
Constructor Details
-
GuavaCachedJwkProvider
Creates a new provider that will cache up to 5 jwks for at most 10 minutes- Parameters:
provider- fallback provider to use when jwk is not cached
-
GuavaCachedJwkProvider
public GuavaCachedJwkProvider(JwkProvider provider, long size, long expiresIn, TimeUnit expiresUnit) Creates a new cached provider specifying cache size and ttl- Parameters:
provider- fallback provider to use when jwk is not cachedsize- number of jwk to cacheexpiresIn- amount of time a jwk will live in the cacheexpiresUnit- unit of the expiresIn parameter
-
GuavaCachedJwkProvider
Creates a new cached provider specifying cache size and ttl- Parameters:
provider- fallback provider to use when jwk is not cachedsize- number of jwt to cacheexpiresIn- amount of time a jwk will live in the cache
-
-
Method Details
-
get
Description copied from interface:JwkProviderAttempts to get a JWK using the Key ID value. Note that implementations are synchronous (blocking).- Specified by:
getin interfaceJwkProvider- Parameters:
keyId- value of the kid found in a JWT- Returns:
- a JWK
- Throws:
SigningKeyNotFoundException- if no jwk can be found using the given kidJwkException
-