Class HttpClientSecuritySupport

java.lang.Object
org.opensaml.security.httpclient.HttpClientSecuritySupport

public final class HttpClientSecuritySupport extends Object
Support class for working with HttpClient security features.
  • Field Details

    • LOG

      @Nonnull private static final org.slf4j.Logger LOG
      Logger.
  • Constructor Details

    • HttpClientSecuritySupport

      private HttpClientSecuritySupport()
      Constructor.
  • Method Details

    • getGlobalHttpClientSecurityConfiguration

      public static HttpClientSecurityConfiguration getGlobalHttpClientSecurityConfiguration()
      Get the global HttpClientSecurityConfiguration instance.
      Returns:
      the global HttpClient security configuration
    • addDefaultTLSTrustEngineCriteria

      public static void addDefaultTLSTrustEngineCriteria(@Nonnull org.apache.hc.client5.http.protocol.HttpClientContext context, @Nonnull org.apache.hc.core5.http.HttpRequest request)
      Add default trust engine criteria for TLS usage to the HttpClientContext.
      Parameters:
      context - the current HTTP context instance in use
      request - the current HTTP request
    • checkTLSCredentialEvaluated

      public static void checkTLSCredentialEvaluated(@Nonnull org.apache.hc.client5.http.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 use
      scheme - the HTTP request scheme
      Throws:
      SSLPeerUnverifiedException - thrown if the TLS credential was not actually evaluated by the trust engine
    • buildHttpClientContext

      @Nonnull public static org.apache.hc.client5.http.protocol.HttpClientContext buildHttpClientContext(@Nullable HttpClientSecurityParameters securityParameters)
      Builds a new HttpClientContext and marshals the supplied HttpClientSecurityParameters into it.
      Parameters:
      securityParameters - the parameters to apply to the context
      Returns:
      the fresh context
      Since:
      5.0.0
    • marshalSecurityParameters

      public static void marshalSecurityParameters(@Nonnull org.apache.hc.client5.http.protocol.HttpClientContext context, @Nullable HttpClientSecurityParameters securityParameters)
      Marshal the supplied HttpClientSecurityParameters to the supplied HttpClientContext.

      Existing context values will NOT be replaced by non-null parameter values.

      Parameters:
      context - the client context instance
      securityParameters - the security parameters instance
    • marshalSecurityParameters

      public static void marshalSecurityParameters(@Nonnull org.apache.hc.client5.http.protocol.HttpClientContext context, @Nullable HttpClientSecurityParameters securityParameters, boolean replace)
      Marshal the supplied HttpClientSecurityParameters to the supplied HttpClientContext.
      Parameters:
      context - the client context instance
      securityParameters - the security parameters instance
      replace - whether a non-null security parameter value should replace an existing context value
    • setContextValue

      public static void setContextValue(@Nonnull org.apache.hc.client5.http.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 instance
      attributeName - the context attribute name to
      attributeValue - the context attribute value to set, may be null
      replace - whether a non-null argument value should replace an existing context value