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
@ThreadSafe public abstract class AbstractDuoAuthenticator extends AbstractInitializableComponent
A base class for authentication actions which call a Duo AuthAPI endpont.
-
Field Summary
Fields Modifier and Type Field Description private org.apache.http.client.HttpClient
httpClient
HttpClient for contacting Duo.private HttpClientSecurityParameters
httpClientSecurityParameters
HTTP client security parameters.private com.fasterxml.jackson.databind.ObjectMapper
objectMapper
JSON object mapper. -
Constructor Summary
Constructors Constructor Description AbstractDuoAuthenticator()
-
Method Summary
Modifier and Type Method Description protected <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
doInitialize()
void
setHttpClient(org.apache.http.client.HttpClient client)
Set theHttpClient
to use for contacting Duo.void
setHttpClientSecurityParameters(HttpClientSecurityParameters params)
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, IOExceptionPerforms 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
-