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.
-
-
Constructor Summary
Constructors Modifier Constructor Description privateHttpClientSecuritySupport()Constructor.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidaddDefaultTLSTrustEngineCriteria(HttpClientContext context, HttpUriRequest request)Add default trust engine criteria for TLS usage to theHttpClientContext.static voidcheckTLSCredentialEvaluated(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(HttpClientContext context, HttpClientSecurityParameters securityParameters)Marshal the suppliedHttpClientSecurityParametersto the suppliedHttpClientContext.static voidmarshalSecurityParameters(HttpClientContext context, HttpClientSecurityParameters securityParameters, boolean replace)Marshal the suppliedHttpClientSecurityParametersto the suppliedHttpClientContext.static voidsetContextValue(HttpClientContext context, String attributeName, Object attributeValue, boolean replace)Set the supplied attribute value in the client context.
-
-
-
Field Detail
-
LOG
private static final Logger LOG
Logger.
-
-
Method Detail
-
getGlobalHttpClientSecurityConfiguration
public static HttpClientSecurityConfiguration getGlobalHttpClientSecurityConfiguration()
Get the globalHttpClientSecurityConfigurationinstance.- Returns:
- the global HttpClient security configuration
-
addDefaultTLSTrustEngineCriteria
public static void addDefaultTLSTrustEngineCriteria(@Nonnull HttpClientContext context, @Nonnull 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 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 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 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 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
-
-