Class AbstractHttpOIDCAuthenticationAction<T>
- java.lang.Object
-
- net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
-
- org.opensaml.profile.action.AbstractProfileAction
-
- org.opensaml.profile.action.AbstractConditionalProfileAction
-
- net.shibboleth.idp.profile.AbstractProfileAction
-
- net.shibboleth.idp.authn.AbstractAuthenticationAction
-
- net.shibboleth.idp.plugin.authn.oidc.rp.impl.AbstractOIDCAuthenticationResponseAction
-
- net.shibboleth.idp.plugin.authn.oidc.rp.impl.AbstractHttpOIDCAuthenticationAction<T>
-
- Type Parameters:
T- the response type of the object returned as a result of the request.
- All Implemented Interfaces:
Component,DestructableComponent,InitializableComponent,ProfileAction,Aware,MessageSource,MessageSourceAware,Action
- Direct Known Subclasses:
ExchangeCodeForAccessToken,UserInfoEndpointLookup
@ThreadSafeAfterInit public abstract class AbstractHttpOIDCAuthenticationAction<T> extends AbstractOIDCAuthenticationResponseAction
An abstract class for OIDC actions that make synchronous HTTP requests.
-
-
Field Summary
Fields Modifier and Type Field Description private org.apache.http.client.HttpClienthttpClientHttpClient for contacting the endpoint.private HttpClientSecurityParametershttpClientSecurityParametersHTTP client security parameters.private Function<ProfileRequestContext,org.apache.http.client.methods.HttpUriRequest>httpRequestEncoderStrategyThe message encoder to encode the HTTP request into aHttpUriRequest.private Function<org.apache.http.HttpResponse,T>httpResponseDecoderStrategyThe message decoder to decode the HTTP response.private org.slf4j.LoggerlogClass logger.
-
Constructor Summary
Constructors Constructor Description AbstractHttpOIDCAuthenticationAction()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voiddoInitialize()protected org.apache.http.HttpResponseexecuteHttpRequest(org.apache.http.client.methods.HttpUriRequest request, AbstractAuthenticatableOIDCContext authenticatableContext)Performs a call to an HTTP endpoint using the configured HttpClient and security parameters.Function<ProfileRequestContext,org.apache.http.client.methods.HttpUriRequest>getHttpRequestEncoderStrategy()Get the HTTP request encoder strategy.Function<org.apache.http.HttpResponse,T>getHttpResponseDecoderStrategy()Get the HTTP response decoder strategy.protected ThandleRequest(ProfileRequestContext profileRequestContext, AbstractAuthenticatableOIDCContext authenticatableContext)Encode the request using the supplied request encoder strategy.voidsetHttpClient(org.apache.http.client.HttpClient client)Set theHttpClientto use.voidsetHttpClientSecurityParameters(HttpClientSecurityParameters params)Set the optional client security parameters.voidsetHttpRequestEncoderStrategy(Function<ProfileRequestContext,org.apache.http.client.methods.HttpUriRequest> strategy)Set the strategy used to map a HTTP request to aHttpUriRequestobject.voidsetHttpResponseDecoderStrategy(Function<org.apache.http.HttpResponse,T> strategy)Set the strategy used to map a HTTP response the response type.-
Methods inherited from class net.shibboleth.idp.plugin.authn.oidc.rp.impl.AbstractOIDCAuthenticationResponseAction
doPreExecute, getAuthenticationRequest, getAuthenticationResponse, getProviderMetadataContext, setProviderMetadataLookupStrategy
-
Methods inherited from class net.shibboleth.idp.authn.AbstractAuthenticationAction
doExecute, doExecute, doPreExecute, setAuthenticationContextLookupStrategy
-
Methods inherited from class net.shibboleth.idp.profile.AbstractProfileAction
doExecute, execute, getMessage, getMessage, getMessage, getProfileContextLookupStrategy, getRequestContext, getResult, setMessageSource, setProfileContextLookupStrategy
-
Methods inherited from class org.opensaml.profile.action.AbstractConditionalProfileAction
getActivationCondition, setActivationCondition
-
Methods inherited from class org.opensaml.profile.action.AbstractProfileAction
doPostExecute, doPostExecute, execute, getHttpServletRequest, getHttpServletResponse, getLogPrefix, setHttpServletRequest, setHttpServletResponse
-
Methods inherited from class net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
destroy, doDestroy, initialize, isDestroyed, isInitialized
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.shibboleth.utilities.java.support.component.InitializableComponent
initialize, isInitialized
-
-
-
-
Field Detail
-
log
@Nonnull private final org.slf4j.Logger log
Class logger.
-
httpRequestEncoderStrategy
@NonnullAfterInit private Function<ProfileRequestContext,org.apache.http.client.methods.HttpUriRequest> httpRequestEncoderStrategy
The message encoder to encode the HTTP request into aHttpUriRequest.
-
httpResponseDecoderStrategy
@NonnullAfterInit private Function<org.apache.http.HttpResponse,T> httpResponseDecoderStrategy
The message decoder to decode the HTTP response.
-
httpClient
@NonnullAfterInit private org.apache.http.client.HttpClient httpClient
HttpClient for contacting the endpoint.
-
httpClientSecurityParameters
@Nullable private HttpClientSecurityParameters httpClientSecurityParameters
HTTP client security parameters.
-
-
Method Detail
-
doInitialize
protected void doInitialize() throws ComponentInitializationException- Overrides:
doInitializein classAbstractInitializableComponent- Throws:
ComponentInitializationException
-
getHttpRequestEncoderStrategy
@NonnullAfterInit public Function<ProfileRequestContext,org.apache.http.client.methods.HttpUriRequest> getHttpRequestEncoderStrategy()
Get the HTTP request encoder strategy.- Returns:
- the request encoder.
-
getHttpResponseDecoderStrategy
@NonnullAfterInit public Function<org.apache.http.HttpResponse,T> getHttpResponseDecoderStrategy()
Get the HTTP response decoder strategy.- Returns:
- the response decoder.
-
setHttpResponseDecoderStrategy
public void setHttpResponseDecoderStrategy(@Nonnull Function<org.apache.http.HttpResponse,T> strategy)Set the strategy used to map a HTTP response the response type.- Parameters:
strategy- the strategy
-
setHttpRequestEncoderStrategy
public void setHttpRequestEncoderStrategy(@Nonnull Function<ProfileRequestContext,org.apache.http.client.methods.HttpUriRequest> strategy)Set the strategy used to map a HTTP request to aHttpUriRequestobject.- Parameters:
strategy- the strategy
-
setHttpClient
public void setHttpClient(@Nonnull org.apache.http.client.HttpClient client)Set theHttpClientto use.- Parameters:
client- client to use
-
setHttpClientSecurityParameters
public void setHttpClientSecurityParameters(@Nullable HttpClientSecurityParameters params)Set the optional client security parameters.- Parameters:
params- the new client security parameters
-
handleRequest
@Nonnull protected T handleRequest(@Nonnull ProfileRequestContext profileRequestContext, @Nullable AbstractAuthenticatableOIDCContext authenticatableContext) throws OIDCRPException
Encode the request using the supplied request encoder strategy. Execute a synchronous HTTP request and decode the response using the supplied decoder strategy.- Parameters:
profileRequestContext- the context to pull information out of for encoding the request.authenticatableContext- an authenticatable context to set the authenticated flag. Can be null if no flag is supplied.- Returns:
- the decoded response.
- Throws:
OIDCRPException- on error making the request.
-
executeHttpRequest
@Nonnull protected org.apache.http.HttpResponse executeHttpRequest(@Nonnull org.apache.http.client.methods.HttpUriRequest request, @Nullable AbstractAuthenticatableOIDCContext authenticatableContext) throws IOExceptionPerforms a call to an HTTP endpoint using the configured HttpClient and security parameters.- Parameters:
request- the prepared HTTP requestauthenticatableContext- an authenticatable context to set the authenticated flag. Can be null if no flag is supplied.- Returns:
- the HTTP response, never
null. - Throws:
IOException- if there is an error producing a response
-
-