Package org.opensaml.security.httpclient
Class HttpClientSecuritySupport
- java.lang.Object
-
- org.opensaml.security.httpclient.HttpClientSecuritySupport
-
public final class HttpClientSecuritySupport extends Object
Support class for working withHttpClient
security features.
-
-
Field Summary
Fields Modifier and Type Field Description private static org.slf4j.Logger
LOG
Logger.
-
Constructor Summary
Constructors Modifier Constructor Description private
HttpClientSecuritySupport()
Constructor.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
addDefaultTLSTrustEngineCriteria(org.apache.http.client.protocol.HttpClientContext context, org.apache.http.client.methods.HttpUriRequest request)
Add default trust engine criteria for TLS usage to theHttpClientContext
.static void
checkTLSCredentialEvaluated(org.apache.http.client.protocol.HttpClientContext context, String scheme)
Check that trust engine evaluation of the server TLS credential was actually performed when the scheme is HTTPS.static HttpClientSecurityConfiguration
getGlobalHttpClientSecurityConfiguration()
Get the globalHttpClientSecurityConfiguration
instance.static void
marshalSecurityParameters(org.apache.http.client.protocol.HttpClientContext context, HttpClientSecurityParameters securityParameters)
Marshal the suppliedHttpClientSecurityParameters
to the suppliedHttpClientContext
.static void
marshalSecurityParameters(org.apache.http.client.protocol.HttpClientContext context, HttpClientSecurityParameters securityParameters, boolean replace)
Marshal the suppliedHttpClientSecurityParameters
to the suppliedHttpClientContext
.static void
setContextValue(org.apache.http.client.protocol.HttpClientContext context, String attributeName, Object attributeValue, boolean replace)
Set the supplied attribute value in the client context.
-
-
-
Method Detail
-
getGlobalHttpClientSecurityConfiguration
public static HttpClientSecurityConfiguration getGlobalHttpClientSecurityConfiguration()
Get the globalHttpClientSecurityConfiguration
instance.- Returns:
- the global HttpClient security configuration
-
addDefaultTLSTrustEngineCriteria
public static void addDefaultTLSTrustEngineCriteria(@Nonnull org.apache.http.client.protocol.HttpClientContext context, @Nonnull org.apache.http.client.methods.HttpUriRequest request)
Add default trust engine criteria for TLS usage to theHttpClientContext
.- Parameters:
context
- the current HTTP context instance in userequest
- the current HTTP request
-
checkTLSCredentialEvaluated
public static void checkTLSCredentialEvaluated(@Nonnull org.apache.http.client.protocol.HttpClientContext context, @Nonnull String scheme) throws SSLPeerUnverifiedException
Check that trust engine evaluation of the server TLS credential was actually performed when the scheme is HTTPS.- Parameters:
context
- the current HTTP context instance in usescheme
- the HTTP request scheme- Throws:
SSLPeerUnverifiedException
- thrown if the TLS credential was not actually evaluated by the trust engine
-
marshalSecurityParameters
public static void marshalSecurityParameters(@Nonnull org.apache.http.client.protocol.HttpClientContext context, @Nullable HttpClientSecurityParameters securityParameters)
Marshal the suppliedHttpClientSecurityParameters
to the suppliedHttpClientContext
.Existing context values will NOT be replaced by non-null parameter values.
- Parameters:
context
- the client context instancesecurityParameters
- the security parameters instance
-
marshalSecurityParameters
public static void marshalSecurityParameters(@Nonnull org.apache.http.client.protocol.HttpClientContext context, @Nullable HttpClientSecurityParameters securityParameters, boolean replace)
Marshal the suppliedHttpClientSecurityParameters
to the suppliedHttpClientContext
.- Parameters:
context
- the client context instancesecurityParameters
- the security parameters instancereplace
- whether a non-null security parameter value should replace an existing context value
-
setContextValue
public static void setContextValue(@Nonnull org.apache.http.client.protocol.HttpClientContext context, @Nonnull String attributeName, @Nullable Object attributeValue, boolean replace)
Set the supplied attribute value in the client context.- Parameters:
context
- the client context instanceattributeName
- the context attribute name toattributeValue
- the context attribute value to set, may be nullreplace
- whether a non-null argument value should replace an existing context value
-
-