Class AbstractDuoAuthenticator
java.lang.Object
net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
net.shibboleth.idp.authn.duo.impl.AbstractDuoAuthenticator
- All Implemented Interfaces:
Component
,DestructableComponent
,InitializableComponent
- Direct Known Subclasses:
DuoAuthAuthenticator
,DuoPreauthAuthenticator
A base class for authentication actions which call a Duo AuthAPI endpont.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate org.apache.http.client.HttpClient
HttpClient for contacting Duo.private HttpClientSecurityParameters
HTTP client security parameters.private com.fasterxml.jackson.databind.ObjectMapper
JSON object mapper. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected <T extends DuoResponseWrapper<?>>
TdoAPIRequest
(org.apache.http.client.methods.HttpUriRequest request, com.fasterxml.jackson.core.type.TypeReference<T> wrapperTypeRef) Performs a call to the Duo AuthAPI.protected void
void
setHttpClient
(org.apache.http.client.HttpClient client) Set theHttpClient
to use for contacting Duo.void
Set the optional client security parameters.void
setObjectMapper
(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 Details
-
httpClient
HttpClient for contacting Duo. -
httpClientSecurityParameters
HTTP client security parameters. -
objectMapper
JSON object mapper.
-
-
Constructor Details
-
AbstractDuoAuthenticator
public AbstractDuoAuthenticator()
-
-
Method Details
-
setHttpClient
public void setHttpClient(@Nonnull org.apache.http.client.HttpClient client) Set theHttpClient
to use for contacting Duo.- Parameters:
client
- HttpClient
-
setHttpClientSecurityParameters
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
-
doInitialize
- Overrides:
doInitialize
in classAbstractInitializableComponent
- 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 ofDuoResponseWrapper
.- Type Parameters:
T
- the DuoResponse type being wrapped- Parameters:
request
- the prepared HTTP requestwrapperTypeRef
- the type ofDuoResponseWrapper
to use- Returns:
- a
DuoResponseWrapper
- Throws:
IOException
- on an I/O errororg.apache.http.client.ClientProtocolException
- on an HTTP errorcom.duosecurity.duoweb.DuoWebException
- on a Duo-related error
-