Package org.opencastproject.security.jwt
Class GuavaCachedUrlJwkProvider
java.lang.Object
com.auth0.jwk.UrlJwkProvider
org.opencastproject.security.jwt.GuavaCachedUrlJwkProvider
- All Implemented Interfaces:
com.auth0.jwk.JwkProvider
public class GuavaCachedUrlJwkProvider
extends com.auth0.jwk.UrlJwkProvider
JWK provider that caches previously fetched JWKs in memory using a Google Guava cache.
-
Constructor Summary
ConstructorsConstructorDescriptionGuavaCachedUrlJwkProvider(String jwksUrl, long expiresIn, TimeUnit expiresUnit) Cons a new cached provider from a JWKs URL and a TTL. -
Method Summary
Modifier and TypeMethodDescriptionList<com.auth0.jwt.algorithms.Algorithm> getAlgorithms(com.auth0.jwt.interfaces.DecodedJWT jwt, boolean forceFetch) Getter for all algorithms corresponding to the fetched JWKs.List<com.auth0.jwk.Jwk> getAll()List<com.auth0.jwk.Jwk> getAll(boolean forceFetch) Getter for all JWKs.Methods inherited from class com.auth0.jwk.UrlJwkProvider
get
-
Constructor Details
-
GuavaCachedUrlJwkProvider
Cons a new cached provider from a JWKs URL and a TTL.- Parameters:
jwksUrl- The URL where JWKs are published.expiresIn- The amount of time the fetched JWKs will live in the cache.expiresUnit- The unit of the expiresIn parameter.
-
-
Method Details
-
getAll
- Overrides:
getAllin classcom.auth0.jwk.UrlJwkProvider
-
getAll
Getter for all JWKs.- Parameters:
forceFetch- Whether to force a re-fetch.- Returns:
- The JWKs.
-
getAlgorithms
public List<com.auth0.jwt.algorithms.Algorithm> getAlgorithms(com.auth0.jwt.interfaces.DecodedJWT jwt, boolean forceFetch) throws com.auth0.jwk.JwkException Getter for all algorithms corresponding to the fetched JWKs.- Parameters:
jwt- The decoded JWT.forceFetch- Whether to force a re-fetch.- Returns:
- The algorithms.
- Throws:
com.auth0.jwk.JwkException- If the algorithms cannot be constructed from the JWKs.
-