Class HttpClientSecuritySupport


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

      • LOG

        private static final org.slf4j.Logger LOG
        Logger.
    • Constructor Detail

      • HttpClientSecuritySupport

        private HttpClientSecuritySupport()
        Constructor.
    • Method Detail

      • 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 the HttpClientContext.
        Parameters:
        context - the current HTTP context instance in use
        request - 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 use
        scheme - 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 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.http.client.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.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 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