Class AbstractDuoAuthenticator

All Implemented Interfaces:
Component, DestructableComponent, InitializableComponent
Direct Known Subclasses:
DuoAuthAuthenticator, DuoPreauthAuthenticator

@ThreadSafe
public abstract class AbstractDuoAuthenticator
extends AbstractInitializableComponent
A base class for authentication actions which call a Duo AuthAPI endpont.
  • Field Details

    • httpClient

      @NonnullAfterInit private org.apache.http.client.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

    • AbstractDuoAuthenticator

      public AbstractDuoAuthenticator()
  • Method Details

    • setHttpClient

      public void setHttpClient​(@Nonnull org.apache.http.client.HttpClient client)
      Set the HttpClient to use for contacting Duo.
      Parameters:
      client - HttpClient
    • 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
    • doInitialize

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

      protected <T extends DuoResponseWrapper<?>> T doAPIRequest​(@Nonnull org.apache.http.client.methods.HttpUriRequest request, @Nonnull com.fasterxml.jackson.core.type.TypeReference<T> wrapperTypeRef) throws com.duosecurity.duoweb.DuoWebException, org.apache.http.client.ClientProtocolException, IOException
      Performs a call to the Duo AuthAPI. Upon a successful call, the JSON response is mapped into the appropriate type of DuoResponseWrapper.
      Type Parameters:
      T - the DuoResponse type being wrapped
      Parameters:
      request - the prepared HTTP request
      wrapperTypeRef - the type of DuoResponseWrapper to use
      Returns:
      a DuoResponseWrapper
      Throws:
      IOException - on an I/O error
      org.apache.http.client.ClientProtocolException - on an HTTP error
      com.duosecurity.duoweb.DuoWebException - on a Duo-related error