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:JwkProvider
Returns a jwk using the kid value- Specified by:
get
in interfaceJwkProvider
- Parameters:
keyId
- value of kid found in JWT- Returns:
- a jwk
- Throws:
SigningKeyNotFoundException
- if no jwk can be found using the given kidJwkException
-