Class NimbusClientFactory
- java.lang.Object
-
- net.shibboleth.utilities.java.support.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 Summary
Fields Modifier and Type Field Description private org.apache.http.client.HttpClienthttpClientHttpClient for contacting Duo.private HttpClientSecurityParametershttpClientSecurityParametersHTTP client security parameters.private com.fasterxml.jackson.databind.ObjectMapperobjectMapperJSON object mapper.
-
Constructor Summary
Constructors Constructor Description NimbusClientFactory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DuoOIDCClientcreateInstance(DuoOIDCIntegration integration)Create anDuoOIDCClientinstance from the supplied integration.protected voiddoInitialize()private org.apache.http.client.HttpClientgetHttpClient()Internally synchronized method for returning the HttpClient.private HttpClientSecurityParametersgetHttpClientSecurityParameters()Internally synchronized method for returning the http client security parameters.private com.fasterxml.jackson.databind.ObjectMappergetObjectMapper()Internally synchronized method for returning the object mapper.voidsetHttpClient(org.apache.http.client.HttpClient client)Set theHttpClientto use for contacting Duo.voidsetHttpClientSecurityParameters(HttpClientSecurityParameters params)Set the optional client security parameters.voidsetObjectMapper(com.fasterxml.jackson.databind.ObjectMapper mapper)Set the JSONObjectMapper.-
Methods inherited from class net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
destroy, doDestroy, initialize, isDestroyed, isInitialized
-
-
-
-
Field Detail
-
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.
-
-
Method Detail
-
createInstance
public DuoOIDCClient createInstance(@Nonnull DuoOIDCIntegration integration) throws DuoClientException
Description copied from interface:DuoOIDCClientFactoryCreate anDuoOIDCClientinstance from the supplied integration.The client should be fully initialised and safely published.
- Specified by:
createInstancein interfaceDuoOIDCClientFactory- 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:
doInitializein classAbstractInitializableComponent- Throws:
ComponentInitializationException
-
getHttpClient
@NonnullAfterInit private org.apache.http.client.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.http.client.HttpClient client)Set theHttpClientto 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 JSONObjectMapper.- Parameters:
mapper- object mapper
-
-