Class SSLBaseFilter

  • All Implemented Interfaces:
    Filter
    Direct Known Subclasses:
    SSLFilter

    public class SSLBaseFilter
    extends BaseFilter
    SSL Filter to operate with SSL encrypted data.
    Author:
    Alexey Stashok
    • Constructor Detail

      • SSLBaseFilter

        public SSLBaseFilter()
      • SSLBaseFilter

        public SSLBaseFilter​(SSLEngineConfigurator serverSSLEngineConfigurator)
        Build SSLFilter with the given SSLEngineConfigurator.
        Parameters:
        serverSSLEngineConfigurator - SSLEngine configurator for server side connections
      • SSLBaseFilter

        public SSLBaseFilter​(SSLEngineConfigurator serverSSLEngineConfigurator,
                             boolean renegotiateOnClientAuthWant)
        Build SSLFilter with the given SSLEngineConfigurator.
        Parameters:
        serverSSLEngineConfigurator - SSLEngine configurator for server side connections
        renegotiateOnClientAuthWant - true, if SSLBaseFilter has to force client authentication during re-handshake, in case the client didn't send its credentials during the initial handshake in response to "wantClientAuth" flag. In this case "needClientAuth" flag will be raised and re-handshake will be initiated
    • Method Detail

      • isRenegotiateOnClientAuthWant

        public boolean isRenegotiateOnClientAuthWant()
        Returns:
        true, if SSLBaseFilter has to force client authentication during re-handshake, in case the client didn't send its credentials during the initial handshake in response to "wantClientAuth" flag. In this case "needClientAuth" flag will be raised and re-handshake will be initiated
      • getHandshakeTimeout

        public long getHandshakeTimeout​(java.util.concurrent.TimeUnit timeUnit)
        Parameters:
        timeUnit - TimeUnit
        Returns:
        the handshake timeout, -1 if blocking handshake mode is disabled (default).
      • setHandshakeTimeout

        public void setHandshakeTimeout​(long handshakeTimeout,
                                        java.util.concurrent.TimeUnit timeUnit)
        Sets the handshake timeout.
        Parameters:
        handshakeTimeout - timeout value, or -1 means for non-blocking handshake mode.
        timeUnit - TimeUnit
      • setRenegotiationDisabled

        public void setRenegotiationDisabled​(boolean renegotiationDisabled)
        Completely disables renegotiation.
        Parameters:
        renegotiationDisabled - true to disable renegotiation.
      • renegotiate

        protected void renegotiate​(SSLConnectionContext sslCtx,
                                   FilterChainContext context)
                            throws java.io.IOException
        Performs an SSL renegotiation.
        Parameters:
        sslCtx - the SSLConnectionContext associated with this this renegotiation request.
        context - the FilterChainContext associated with this this renegotiation request.
        Throws:
        java.io.IOException - if an error occurs during SSL renegotiation.
      • getPeerCertificateChain

        protected void getPeerCertificateChain​(SSLConnectionContext sslCtx,
                                               FilterChainContext context,
                                               boolean needClientAuth,
                                               FutureImpl<java.lang.Object[]> certFuture)

        Obtains the certificate chain for this SSL session. If no certificates are available, and needClientAuth is true, an SSL renegotiation will be be triggered to request the certificates from the client.

        Parameters:
        sslCtx - the SSLConnectionContext associated with this certificate request.
        context - the FilterChainContext associated with this this certificate request.
        needClientAuth - determines whether or not SSL renegotiation will be attempted to obtain the certificate chain.
        certFuture - the future that will be provided the result of the peer certificate processing.
      • notifyHandshakeInit

        protected void notifyHandshakeInit​(Connection<?> connection,
                                           javax.net.ssl.SSLEngine sslEngine)
      • notifyHandshakeStart

        protected void notifyHandshakeStart​(Connection connection)
      • notifyHandshakeComplete

        protected void notifyHandshakeComplete​(Connection<?> connection,
                                               javax.net.ssl.SSLEngine sslEngine)
      • notifyHandshakeFailed

        protected void notifyHandshakeFailed​(Connection connection,
                                             java.lang.Throwable t)