Class RemoteJwkSetCache

  • All Implemented Interfaces:
    net.shibboleth.utilities.java.support.component.Component, net.shibboleth.utilities.java.support.component.DestructableComponent, net.shibboleth.utilities.java.support.component.IdentifiableComponent, net.shibboleth.utilities.java.support.component.IdentifiedComponent, net.shibboleth.utilities.java.support.component.InitializableComponent

    public class RemoteJwkSetCache
    extends net.shibboleth.utilities.java.support.component.AbstractIdentifiableInitializableComponent
    Stores fetched remote key set values for a desired period of time.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static String CONTEXT_NAME
      The context name in the StorageService.
      private org.apache.http.client.HttpClient httpClient
      The HttpClient to use.
      private org.opensaml.security.httpclient.HttpClientSecurityParameters httpClientSecurityParameters
      HTTP client security parameters.
      private org.slf4j.Logger log
      Logger.
      private org.opensaml.storage.StorageService storage
      Backing storage for the remote JWK set contents.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void doInitialize()
      com.nimbusds.jose.jwk.JWKSet fetch​(String context, URI uri, Instant expires)
      Returns remote JWK set if found from the cache, otherwise fetches and stores it.
      com.nimbusds.jose.jwk.JWKSet fetch​(URI uri, Instant expires)
      Returns remote JWK set if found from the cache, otherwise fetches and stores it.
      org.opensaml.storage.StorageService getStorage()
      Get the backing store for the remote JWK set contents.
      void setHttpClient​(org.apache.http.client.HttpClient client)
      Set the HttpClient to use.
      void setHttpClientSecurityParameters​(org.opensaml.security.httpclient.HttpClientSecurityParameters params)
      Set the optional client security parameters.
      void setStorage​(org.opensaml.storage.StorageService storageService)
      Set the backing store for the remote JWK set contents.
      • Methods inherited from class net.shibboleth.utilities.java.support.component.AbstractIdentifiableInitializableComponent

        setId
      • Methods inherited from class net.shibboleth.utilities.java.support.component.AbstractIdentifiedInitializableComponent

        getId
      • Methods inherited from class net.shibboleth.utilities.java.support.component.AbstractInitializableComponent

        destroy, doDestroy, initialize, isDestroyed, isInitialized
      • Methods inherited from interface net.shibboleth.utilities.java.support.component.IdentifiedComponent

        getId
    • Field Detail

      • log

        private final org.slf4j.Logger log
        Logger.
      • storage

        private org.opensaml.storage.StorageService storage
        Backing storage for the remote JWK set contents.
      • httpClient

        @NonnullAfterInit
        private org.apache.http.client.HttpClient httpClient
        The HttpClient to use.
      • httpClientSecurityParameters

        @Nullable
        private org.opensaml.security.httpclient.HttpClientSecurityParameters httpClientSecurityParameters
        HTTP client security parameters.
    • Constructor Detail

      • RemoteJwkSetCache

        public RemoteJwkSetCache()
    • Method Detail

      • getStorage

        @NonnullAfterInit
        public org.opensaml.storage.StorageService getStorage()
        Get the backing store for the remote JWK set contents.
        Returns:
        the backing store.
      • setStorage

        public void setStorage​(@Nonnull
                               org.opensaml.storage.StorageService storageService)
        Set the backing store for the remote JWK set contents.
        Parameters:
        storageService - backing store to use
      • setHttpClient

        public void setHttpClient​(@Nonnull
                                  org.apache.http.client.HttpClient client)
        Set the HttpClient to use.
        Parameters:
        client - client to use
      • setHttpClientSecurityParameters

        public void setHttpClientSecurityParameters​(@Nullable
                                                    org.opensaml.security.httpclient.HttpClientSecurityParameters params)
        Set the optional client security parameters.
        Parameters:
        params - the new client security parameters
      • doInitialize

        public void doInitialize()
                          throws net.shibboleth.utilities.java.support.component.ComponentInitializationException
        Overrides:
        doInitialize in class net.shibboleth.utilities.java.support.component.AbstractIdentifiedInitializableComponent
        Throws:
        net.shibboleth.utilities.java.support.component.ComponentInitializationException
      • fetch

        public com.nimbusds.jose.jwk.JWKSet fetch​(@Nonnull
                                                  URI uri,
                                                  @Nonnull
                                                  Instant expires)
        Returns remote JWK set if found from the cache, otherwise fetches and stores it.
        Parameters:
        uri - value to check
        expires - time for disposal of value from cache
        Returns:
        JWK set, null if not found from the cache and cannot be fetched.
      • fetch

        @Nullable
        public com.nimbusds.jose.jwk.JWKSet fetch​(@Nonnull @NotEmpty
                                                  String context,
                                                  @Nonnull
                                                  URI uri,
                                                  @Nonnull
                                                  Instant expires)
        Returns remote JWK set if found from the cache, otherwise fetches and stores it.
        Parameters:
        context - a context label to subdivide the cache
        uri - value to check
        expires - time (in milliseconds since beginning of epoch) for disposal of value from cache
        Returns:
        JWK set, null if not found from the cache and cannot be fetched.