Class 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 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:
        getAll in class com.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.