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

    Constructors
    Constructor
    Description
    GuavaCachedUrlJwkProvider(String jwksUrl, long expiresIn, TimeUnit expiresUnit)
    Cons a new cached provider from a JWKs URL and a TTL.
  • Method Summary

    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>
     
    List<com.auth0.jwk.Jwk>
    getAll(boolean forceFetch)
    Getter for all JWKs.

    Methods inherited from class com.auth0.jwk.UrlJwkProvider

    get

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • 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 Details

    • 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.