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 withHttpClientsecurity features.
-
-
Field Summary
Fields Modifier and Type Field Description private static org.slf4j.LoggerLOGLogger.
-
Constructor Summary
Constructors Modifier Constructor Description privateHttpClientSecuritySupport()Constructor.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidaddDefaultTLSTrustEngineCriteria(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 voidcheckTLSCredentialEvaluated(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 HttpClientSecurityConfigurationgetGlobalHttpClientSecurityConfiguration()Get the globalHttpClientSecurityConfigurationinstance.static voidmarshalSecurityParameters(org.apache.http.client.protocol.HttpClientContext context, HttpClientSecurityParameters securityParameters)Marshal the suppliedHttpClientSecurityParametersto the suppliedHttpClientContext.static voidmarshalSecurityParameters(org.apache.http.client.protocol.HttpClientContext context, HttpClientSecurityParameters securityParameters, boolean replace)Marshal the suppliedHttpClientSecurityParametersto the suppliedHttpClientContext.static voidsetContextValue(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 globalHttpClientSecurityConfigurationinstance.- 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 SSLPeerUnverifiedExceptionCheck 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 suppliedHttpClientSecurityParametersto 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 suppliedHttpClientSecurityParametersto 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
-
-