OutboundMessageType
- the outbound message typeInboundMessageType
- the inbound message type@ThreadSafe public abstract class AbstractPipelineHttpSOAPClient<OutboundMessageType,InboundMessageType> extends net.shibboleth.utilities.java.support.component.AbstractInitializableComponent implements SOAPClient
HttpClientMessagePipeline
.SOAPClient.SOAPRequestParameters
Modifier and Type | Field and Description |
---|---|
private org.apache.http.client.HttpClient |
httpClient
HTTP client used to send requests and receive responses.
|
private org.opensaml.security.httpclient.HttpClientSecurityParameters |
httpClientSecurityParameters
HTTP client security parameters.
|
private org.slf4j.Logger |
log
Class logger.
|
private com.google.common.base.Function<InOutOperationContext<?,?>,net.shibboleth.utilities.java.support.resolver.CriteriaSet> |
tlsCriteriaSetStrategy
Strategy for building the criteria set which is input to the TLS trust engine.
|
Constructor and Description |
---|
AbstractPipelineHttpSOAPClient()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected org.apache.http.client.protocol.HttpClientContext |
buildHttpContext(org.apache.http.client.methods.HttpUriRequest request,
InOutOperationContext operationContext)
Build the
HttpClientContext instance to be used by the HttpClient. |
protected org.apache.http.client.methods.HttpUriRequest |
buildHttpRequest(String endpoint,
InOutOperationContext operationContext)
Build the
HttpUriRequest instance to be executed by the HttpClient. |
protected net.shibboleth.utilities.java.support.resolver.CriteriaSet |
buildTLSCriteriaSet(org.apache.http.client.methods.HttpUriRequest request,
InOutOperationContext operationContext)
Build the dynamic
CriteriaSet instance to be used for TLS trust evaluation. |
protected void |
checkTLSCredentialTrusted(org.apache.http.client.protocol.HttpClientContext context,
org.apache.http.client.methods.HttpUriRequest request)
Deprecated.
use
HttpClientSecuritySupport.checkTLSCredentialEvaluated(HttpClientContext, String) |
protected void |
doDestroy() |
protected void |
doInitialize() |
org.apache.http.client.HttpClient |
getHttpClient()
Get the client used to make outbound HTTP requests.
|
org.opensaml.security.httpclient.HttpClientSecurityParameters |
getHttpClientSecurityParameters()
Get the optional client security parameters.
|
com.google.common.base.Function<InOutOperationContext<?,?>,net.shibboleth.utilities.java.support.resolver.CriteriaSet> |
getTLSCriteriaSetStrategy()
Get the strategy function which builds the dynamically-populated criteria set which is
input to the TLS TrustEngine, if no static criteria set is supplied either via context
or locally-configured
HttpClientSecurityParameters . |
protected abstract HttpClientMessagePipeline<InboundMessageType,OutboundMessageType> |
newPipeline()
Get a new instance of the
HttpClientMessagePipeline to be processed. |
protected org.apache.http.client.protocol.HttpClientContext |
resolveClientContext(InOutOperationContext operationContext)
Resolve the effective
HttpClientContext instance to use for the current request. |
protected org.opensaml.security.httpclient.HttpClientSecurityParameters |
resolveContextSecurityParameters(InOutOperationContext operationContext)
Resolve the
HttpClientSecurityParameters instance present in the current operation context. |
protected HttpClientMessagePipeline<InboundMessageType,OutboundMessageType> |
resolvePipeline(InOutOperationContext operationContext)
Resolve and return a new instance of the
HttpClientMessagePipeline to be processed. |
void |
send(String endpoint,
InOutOperationContext operationContext)
Sends a message and waits for a response.
|
void |
setHttpClient(org.apache.http.client.HttpClient client)
Set the client used to make outbound HTTP requests.
|
void |
setHttpClientSecurityParameters(org.opensaml.security.httpclient.HttpClientSecurityParameters params)
Set the optional client security parameters.
|
void |
setTLSCriteriaSetStrategy(com.google.common.base.Function<InOutOperationContext<?,?>,net.shibboleth.utilities.java.support.resolver.CriteriaSet> function)
Set the strategy function which builds the dynamically-populated criteria set which is
input to the TLS TrustEngine, if no static criteria set is supplied either via context
or locally-configured
HttpClientSecurityParameters . |
@Nonnull private final org.slf4j.Logger log
@NonnullAfterInit private org.apache.http.client.HttpClient httpClient
@Nullable private org.opensaml.security.httpclient.HttpClientSecurityParameters httpClientSecurityParameters
@Nullable private com.google.common.base.Function<InOutOperationContext<?,?>,net.shibboleth.utilities.java.support.resolver.CriteriaSet> tlsCriteriaSetStrategy
public AbstractPipelineHttpSOAPClient()
protected void doInitialize() throws net.shibboleth.utilities.java.support.component.ComponentInitializationException
doInitialize
in class net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
net.shibboleth.utilities.java.support.component.ComponentInitializationException
protected void doDestroy()
doDestroy
in class net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
@Nonnull public org.apache.http.client.HttpClient getHttpClient()
public void setHttpClient(@Nonnull org.apache.http.client.HttpClient client)
This client SHOULD employ a thread-safe HttpClient
and may be shared with other objects.
client
- client object@Nullable public org.opensaml.security.httpclient.HttpClientSecurityParameters getHttpClientSecurityParameters()
public void setHttpClientSecurityParameters(@Nullable org.opensaml.security.httpclient.HttpClientSecurityParameters params)
params
- the new client security parameters@Nullable public com.google.common.base.Function<InOutOperationContext<?,?>,net.shibboleth.utilities.java.support.resolver.CriteriaSet> getTLSCriteriaSetStrategy()
HttpClientSecurityParameters
.public void setTLSCriteriaSetStrategy(@Nullable com.google.common.base.Function<InOutOperationContext<?,?>,net.shibboleth.utilities.java.support.resolver.CriteriaSet> function)
HttpClientSecurityParameters
.function
- the strategy function, or nullpublic void send(@Nonnull @NotEmpty String endpoint, @Nonnull InOutOperationContext operationContext) throws SOAPException, org.opensaml.security.SecurityException
send
in interface SOAPClient
endpoint
- the endpoint to which to send the messageoperationContext
- the operation context containing the outbound SOAP messageSOAPException
- thrown if there is a problem sending the message or receiving the response or if the
response is a SOAP faultorg.opensaml.security.SecurityException
- thrown if the response does not meet any security policy associated with the message
context@Nonnull protected HttpClientMessagePipeline<InboundMessageType,OutboundMessageType> resolvePipeline(@Nonnull InOutOperationContext operationContext) throws SOAPException
HttpClientMessagePipeline
to be processed.
Each call to this (factory) method MUST produce a new instance of the pipeline.
The default behavior is to simply call newPipeline()
.
operationContext
- the current operation contextSOAPException
- if there is an error obtaining a new pipeline instance@Nonnull protected abstract HttpClientMessagePipeline<InboundMessageType,OutboundMessageType> newPipeline() throws SOAPException
HttpClientMessagePipeline
to be processed.
Each call to this (factory) method MUST produce a new instance of the pipeline.
SOAPException
- if there is an error obtaining a new pipeline instance@Deprecated protected void checkTLSCredentialTrusted(@Nonnull org.apache.http.client.protocol.HttpClientContext context, @Nonnull org.apache.http.client.methods.HttpUriRequest request) throws SSLPeerUnverifiedException
HttpClientSecuritySupport.checkTLSCredentialEvaluated(HttpClientContext, String)
context
- the current HTTP context instance in userequest
- the HTTP URI requestSSLPeerUnverifiedException
- thrown if the TLS credential was not actually evaluated by the trust engine@Nonnull protected org.apache.http.client.methods.HttpUriRequest buildHttpRequest(@Nonnull @NotEmpty String endpoint, @Nonnull InOutOperationContext operationContext)
HttpUriRequest
instance to be executed by the HttpClient.endpoint
- the endpoint to which the message will be sentoperationContext
- the current operation context@Nonnull protected org.apache.http.client.protocol.HttpClientContext buildHttpContext(@Nonnull org.apache.http.client.methods.HttpUriRequest request, @Nonnull InOutOperationContext operationContext)
HttpClientContext
instance to be used by the HttpClient.request
- the HTTP client requestoperationContext
- the current operation contextprotected org.opensaml.security.httpclient.HttpClientSecurityParameters resolveContextSecurityParameters(@Nonnull InOutOperationContext operationContext)
HttpClientSecurityParameters
instance present in the current operation context.
The default implementation returns the outbound subcontext value
HttpClientSecurityContext.getSecurityParameters()
.
Note that any values supplied via this instance will override those supplied locally via
setHttpClientSecurityParameters(HttpClientSecurityParameters)
.
operationContext
- the current operation context@Nonnull protected org.apache.http.client.protocol.HttpClientContext resolveClientContext(@Nonnull InOutOperationContext operationContext)
HttpClientContext
instance to use for the current request.
The default implementation first attempts to resolve the outbound subcontext value
HttpClientRequestContext.getHttpClientContext()
. If no context value is present,
a new empty context instance will be returned via HttpClientContext.create()
.
Note that any security-related attributes supplied directly the client context returned here
will override the corresponding values supplied via both operation context and locally-configured
instances of HttpClientSecurityParameters
.
operationContext
- the current operation context@Nonnull protected net.shibboleth.utilities.java.support.resolver.CriteriaSet buildTLSCriteriaSet(@Nonnull org.apache.http.client.methods.HttpUriRequest request, @Nonnull InOutOperationContext operationContext)
CriteriaSet
instance to be used for TLS trust evaluation.request
- the HTTP client requestoperationContext
- the current operation contextCopyright © 1999–2020 Shibboleth Consortium. All rights reserved.