Class DefaultJWKSetCache

java.lang.Object
com.nimbusds.jose.jwk.source.DefaultJWKSetCache
All Implemented Interfaces:
JWKSetCache

@ThreadSafe @Deprecated public class DefaultJWKSetCache extends Object implements JWKSetCache
Deprecated.
JSON Web Key (JWK) set cache implementation.
Version:
2021-01-08
Author:
Vladimir Dzhuvinov, Sarvesh Sharma
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final long
    Deprecated.
    The default lifespan for cached JWK sets (15 minutes).
    static final long
    Deprecated.
    The default refresh time for cached JWK sets (5 minutes).
  • Constructor Summary

    Constructors
    Constructor
    Description
    Deprecated.
    Creates a new JWK set, the default lifespan of the cached JWK set is set to 15 minutes, the refresh time to 5 minutes.
    DefaultJWKSetCache(long lifespan, long refreshTime, TimeUnit timeUnit)
    Deprecated.
    Creates a new JWK set cache.
  • Method Summary

    Modifier and Type
    Method
    Description
    get()
    Deprecated.
    Gets the cached JWK set.
    long
    Deprecated.
    Returns the configured lifespan of the cached JWK.
    long
    Deprecated.
    Returns the cache put timestamp.
    long
    Deprecated.
    Returns the configured refresh time of the cached JWK.
    boolean
    Deprecated.
    Returns true if the cached JWK set is expired.
    void
    put(JWKSet jwkSet)
    Deprecated.
    Puts the specified JWK set into the cache or clears the cache.
    boolean
    Deprecated.
    Returns true if the cached JWK set requires a refresh.

    Methods inherited from class java.lang.Object

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

  • Constructor Details

    • DefaultJWKSetCache

      Deprecated.
      Creates a new JWK set, the default lifespan of the cached JWK set is set to 15 minutes, the refresh time to 5 minutes.
    • DefaultJWKSetCache

      public DefaultJWKSetCache(long lifespan, long refreshTime, TimeUnit timeUnit)
      Deprecated.
      Creates a new JWK set cache.
      Parameters:
      lifespan - The lifespan of the cached JWK set before it expires, negative means no expiration.
      refreshTime - The time after which the cached JWK set is marked for refresh, negative if not specified. Should be shorter or equal to the lifespan.
      timeUnit - The lifespan time unit, may be null if no expiration or refresh time.
  • Method Details

    • put

      public void put(JWKSet jwkSet)
      Deprecated.
      Description copied from interface: JWKSetCache
      Puts the specified JWK set into the cache or clears the cache.
      Specified by:
      put in interface JWKSetCache
      Parameters:
      jwkSet - The JWK set to cache, null to clear the cache.
    • get

      public JWKSet get()
      Deprecated.
      Description copied from interface: JWKSetCache
      Gets the cached JWK set.
      Specified by:
      get in interface JWKSetCache
      Returns:
      The cached JWK set, null if none or expired.
    • requiresRefresh

      public boolean requiresRefresh()
      Deprecated.
      Description copied from interface: JWKSetCache
      Returns true if the cached JWK set requires a refresh. This should typically occur some time before the cache has expired, to allow for transient retrieval exceptions before expiration.
      Specified by:
      requiresRefresh in interface JWKSetCache
      Returns:
      true if the cached JWK set requires a refresh.
    • getPutTimestamp

      public long getPutTimestamp()
      Deprecated.
      Returns the cache put timestamp.
      Returns:
      The cache put timestamp, negative if not specified.
    • isExpired

      public boolean isExpired()
      Deprecated.
      Returns true if the cached JWK set is expired.
      Returns:
      true if expired.
    • getLifespan

      public long getLifespan(TimeUnit timeUnit)
      Deprecated.
      Returns the configured lifespan of the cached JWK.
      Parameters:
      timeUnit - The time unit to use.
      Returns:
      The configured lifespan, negative means no expiration.
    • getRefreshTime

      public long getRefreshTime(TimeUnit timeUnit)
      Deprecated.
      Returns the configured refresh time of the cached JWK.
      Parameters:
      timeUnit - The time unit to use.
      Returns:
      The configured refresh time, negative means no expiration.