Class SecurityEnhancedTLSSocketFactory

    • Constructor Detail

      • SecurityEnhancedTLSSocketFactory

        public SecurityEnhancedTLSSocketFactory​(@Nonnull
                                                org.apache.http.conn.socket.LayeredConnectionSocketFactory factory)
        Constructor.
        Parameters:
        factory - the underlying HttpClient socket factory wrapped by this implementation.
    • Method Detail

      • createSocket

        public Socket createSocket​(org.apache.http.protocol.HttpContext context)
                            throws IOException
        Specified by:
        createSocket in interface org.apache.http.conn.socket.ConnectionSocketFactory
        Throws:
        IOException
      • connectSocket

        public Socket connectSocket​(int connectTimeout,
                                    Socket sock,
                                    org.apache.http.HttpHost host,
                                    InetSocketAddress remoteAddress,
                                    InetSocketAddress localAddress,
                                    org.apache.http.protocol.HttpContext context)
                             throws IOException
        Specified by:
        connectSocket in interface org.apache.http.conn.socket.ConnectionSocketFactory
        Throws:
        IOException
      • createLayeredSocket

        public Socket createLayeredSocket​(Socket socket,
                                          String target,
                                          int port,
                                          org.apache.http.protocol.HttpContext context)
                                   throws IOException
        Specified by:
        createLayeredSocket in interface org.apache.http.conn.socket.LayeredConnectionSocketFactory
        Throws:
        IOException
      • checkAndEvaluateServerTLS

        protected void checkAndEvaluateServerTLS​(@Nonnull
                                                 Socket socket)
                                          throws IOException
        Check that the evaluation of the socket certificate using the data in ThreadLocalX509TrustEngineContext has been performed, if applicable, and if not, evaluate it.

        This will usually be called only in the case of TLS session resumption, when the standard JSSE trust manager evaluation has not run.

        Parameters:
        socket - the current socket being evaluated
        Throws:
        IOException
      • setup

        protected void setup​(@Nullable
                             org.apache.http.protocol.HttpContext context,
                             @Nonnull
                             String hostname)
                      throws SSLPeerUnverifiedException
        Setup calling execution environment for server TLS and client TLS based on information supplied in the HttpContext.
        Parameters:
        context - the HttpContext instance
        hostname - the hostname for the connection
        Throws:
        SSLPeerUnverifiedException - if required data is not available from the context
      • setupClientTLS

        protected void setupClientTLS​(@Nonnull
                                      org.apache.http.protocol.HttpContext context)
        Setup thread-local data for server TLS and client TLS based on information supplied in the HttpContext.
        Parameters:
        context - the HttpContext instance
      • setupServerTLS

        protected void setupServerTLS​(@Nonnull
                                      org.apache.http.protocol.HttpContext context,
                                      @Nonnull
                                      String hostname)
        Setup thread-local data for server TLS.
        Parameters:
        context - the HttpContext instance
        hostname - the hostname for the connection
      • teardown

        protected void teardown​(@Nullable
                                org.apache.http.protocol.HttpContext context)
        Schedule the deferred clearing of the ThreadLocalX509CredentialContext of the client TLS credential obtained from the HttpContext.
        Parameters:
        context - the HttpContext instance