OutboundMessageType
- the outbound message typeInboundMessageType
- the inbound message type@ThreadSafe public abstract class AbstractPipelineHttpSOAPClient<OutboundMessageType,InboundMessageType> extends AbstractInitializableComponent implements SOAPClient
HttpClientMessagePipeline
.SOAPClient.SOAPRequestParameters
Modifier and Type | Field and Description |
---|---|
private 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 Function<InOutOperationContext<?,?>,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 HttpClientContext |
buildHttpContext(HttpUriRequest request,
InOutOperationContext operationContext)
Build the
HttpClientContext instance to be used by the HttpClient. |
protected HttpUriRequest |
buildHttpRequest(String endpoint,
InOutOperationContext operationContext)
Build the
HttpUriRequest instance to be executed by the HttpClient. |
protected CriteriaSet |
buildTLSCriteriaSet(HttpUriRequest request,
InOutOperationContext operationContext)
Build the dynamic
CriteriaSet instance to be used for TLS trust evaluation. |
protected void |
checkTLSCredentialTrusted(HttpClientContext context,
HttpUriRequest request)
Deprecated.
use
HttpClientSecuritySupport.checkTLSCredentialEvaluated(HttpClientContext, String) |
protected void |
doDestroy() |
protected void |
doInitialize() |
HttpClient |
getHttpClient()
Get the client used to make outbound HTTP requests.
|
org.opensaml.security.httpclient.HttpClientSecurityParameters |
getHttpClientSecurityParameters()
Get the optional client security parameters.
|
Function<InOutOperationContext<?,?>,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 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(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(Function<InOutOperationContext<?,?>,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 . |
destroy, initialize, isDestroyed, isInitialized
@Nonnull private final org.slf4j.Logger log
@NonnullAfterInit private HttpClient httpClient
@Nullable private org.opensaml.security.httpclient.HttpClientSecurityParameters httpClientSecurityParameters
@Nullable private Function<InOutOperationContext<?,?>,CriteriaSet> tlsCriteriaSetStrategy
public AbstractPipelineHttpSOAPClient()
protected void doInitialize() throws ComponentInitializationException
doInitialize
in class AbstractInitializableComponent
ComponentInitializationException
protected void doDestroy()
doDestroy
in class AbstractInitializableComponent
@Nonnull public HttpClient getHttpClient()
public void setHttpClient(@Nonnull 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 Function<InOutOperationContext<?,?>,CriteriaSet> getTLSCriteriaSetStrategy()
HttpClientSecurityParameters
.public void setTLSCriteriaSetStrategy(@Nullable Function<InOutOperationContext<?,?>,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 HttpClientContext context, @Nonnull 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 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 HttpClientContext buildHttpContext(@Nonnull 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 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 CriteriaSet buildTLSCriteriaSet(@Nonnull HttpUriRequest request, @Nonnull InOutOperationContext operationContext)
CriteriaSet
instance to be used for TLS trust evaluation.request
- the HTTP client requestoperationContext
- the current operation contextCopyright © 1999–2018 Shibboleth Consortium. All rights reserved.