Class NimbusClientFactory

java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
net.shibboleth.idp.plugin.authn.duo.nimbus.impl.NimbusClientFactory
All Implemented Interfaces:
DuoOIDCClientFactory, Component, DestructableComponent, InitializableComponent

@ThreadSafe public final class NimbusClientFactory extends AbstractInitializableComponent implements DuoOIDCClientFactory

Abstract factory implementation for creating new NimbusClients.

Each client instance shares the same, thread-safe, http client and object mapper.

  • Field Details

    • httpClient

      @NonnullAfterInit private org.apache.hc.client5.http.classic.HttpClient httpClient
      HttpClient for contacting Duo.
    • httpClientSecurityParameters

      @Nullable private HttpClientSecurityParameters httpClientSecurityParameters
      HTTP client security parameters.
    • objectMapper

      @NonnullAfterInit private com.fasterxml.jackson.databind.ObjectMapper objectMapper
      JSON object mapper.
  • Constructor Details

    • NimbusClientFactory

      public NimbusClientFactory()
  • Method Details

    • createInstance

      @Nonnull public DuoOIDCClient createInstance(@Nonnull DuoOIDCIntegration integration) throws DuoClientException
      Description copied from interface: DuoOIDCClientFactory
      Create an DuoOIDCClient instance from the supplied integration.

      The client should be fully initialised and safely published.

      Specified by:
      createInstance in interface DuoOIDCClientFactory
      Parameters:
      integration - the duo integration used to instantiate the client.
      Returns:
      the created Duo client, never null.
      Throws:
      DuoClientException - if there is an error creating the Duo client.
    • doInitialize

      protected void doInitialize() throws ComponentInitializationException
      Overrides:
      doInitialize in class AbstractInitializableComponent
      Throws:
      ComponentInitializationException
    • getHttpClient

      @NonnullAfterInit private org.apache.hc.client5.http.classic.HttpClient getHttpClient()
      Internally synchronized method for returning the HttpClient.
      Returns:
      the http client.
    • getHttpClientSecurityParameters

      @Nullable private HttpClientSecurityParameters getHttpClientSecurityParameters()
      Internally synchronized method for returning the http client security parameters.
      Returns:
      the http client security parameters.
    • getObjectMapper

      @NonnullAfterInit private com.fasterxml.jackson.databind.ObjectMapper getObjectMapper()
      Internally synchronized method for returning the object mapper.
      Returns:
      the object mapper.
    • setHttpClient

      public void setHttpClient(@Nonnull org.apache.hc.client5.http.classic.HttpClient client)
      Set the HttpClient to use for contacting Duo.
      Parameters:
      client - the http client.
    • setHttpClientSecurityParameters

      public void setHttpClientSecurityParameters(@Nullable HttpClientSecurityParameters params)
      Set the optional client security parameters.
      Parameters:
      params - the new client security parameters
    • setObjectMapper

      public void setObjectMapper(@Nonnull com.fasterxml.jackson.databind.ObjectMapper mapper)
      Set the JSON ObjectMapper.
      Parameters:
      mapper - object mapper