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.UrlJwkProviderJWK provider that caches previously fetched JWKs in memory using a Google Guava cache.
-
-
Constructor Summary
Constructors Constructor Description GuavaCachedUrlJwkProvider(String jwksUrl, long expiresIn, TimeUnit expiresUnit)Cons a new cached provider from a JWKs URL and a TTL.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<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.
-
-
-
Constructor Detail
-
GuavaCachedUrlJwkProvider
public GuavaCachedUrlJwkProvider(String jwksUrl, long expiresIn, TimeUnit expiresUnit)
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 Detail
-
getAll
public List<com.auth0.jwk.Jwk> getAll()
- Overrides:
getAllin classcom.auth0.jwk.UrlJwkProvider
-
getAll
public List<com.auth0.jwk.Jwk> getAll(boolean forceFetch)
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.
-
-