Class SaslListMechanismsHandler

  • All Implemented Interfaces:
    com.couchbase.client.core.deps.io.netty.channel.ChannelHandler, com.couchbase.client.core.deps.io.netty.channel.ChannelInboundHandler, com.couchbase.client.core.deps.io.netty.channel.ChannelOutboundHandler

    @Internal
    public class SaslListMechanismsHandler
    extends com.couchbase.client.core.deps.io.netty.channel.ChannelDuplexHandler
    The SaslListMechanismsHandler asks the server KV engine which SASL mechanism it supports.

    Note that this handler only performs the listing and is separate from other SASL handlers in the pipeline which then actually decide what to do with the list. When negotiated, for pipelining reasons, the list of mechanisms is stored in the pipeline so that it can be consumed from other handlers.

    • Nested Class Summary

      • Nested classes/interfaces inherited from interface com.couchbase.client.core.deps.io.netty.channel.ChannelHandler

        com.couchbase.client.core.deps.io.netty.channel.ChannelHandler.Sharable
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void channelActive​(com.couchbase.client.core.deps.io.netty.channel.ChannelHandlerContext ctx)
      As soon as the channel is active start sending the request but also schedule a timeout properly.
      void channelRead​(com.couchbase.client.core.deps.io.netty.channel.ChannelHandlerContext ctx, Object msg)
      As soon as we get a response, turn it into a list of SASL mechanisms the server supports.
      void connect​(com.couchbase.client.core.deps.io.netty.channel.ChannelHandlerContext ctx, SocketAddress remoteAddress, SocketAddress localAddress, com.couchbase.client.core.deps.io.netty.channel.ChannelPromise promise)
      Intercepts the connect process inside the pipeline to only propagate either success or failure if the hello process is completed either way.
      void exceptionCaught​(com.couchbase.client.core.deps.io.netty.channel.ChannelHandlerContext ctx, Throwable cause)
      If there is an exception raised while we are waiting for our connect phase to complete, the error should be propagated as a cause up the pipeline.
      • Methods inherited from class com.couchbase.client.core.deps.io.netty.channel.ChannelDuplexHandler

        bind, close, deregister, disconnect, flush, read, write
      • Methods inherited from class com.couchbase.client.core.deps.io.netty.channel.ChannelInboundHandlerAdapter

        channelInactive, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, userEventTriggered
      • Methods inherited from class com.couchbase.client.core.deps.io.netty.channel.ChannelHandlerAdapter

        ensureNotSharable, handlerAdded, handlerRemoved, isSharable
      • Methods inherited from interface com.couchbase.client.core.deps.io.netty.channel.ChannelHandler

        handlerAdded, handlerRemoved
    • Constructor Detail

      • SaslListMechanismsHandler

        public SaslListMechanismsHandler​(EndpointContext endpointContext)
        Parameters:
        endpointContext - the core context used to refer to values like the core id.
    • Method Detail

      • connect

        public void connect​(com.couchbase.client.core.deps.io.netty.channel.ChannelHandlerContext ctx,
                            SocketAddress remoteAddress,
                            SocketAddress localAddress,
                            com.couchbase.client.core.deps.io.netty.channel.ChannelPromise promise)
        Intercepts the connect process inside the pipeline to only propagate either success or failure if the hello process is completed either way.
        Specified by:
        connect in interface com.couchbase.client.core.deps.io.netty.channel.ChannelOutboundHandler
        Overrides:
        connect in class com.couchbase.client.core.deps.io.netty.channel.ChannelDuplexHandler
        Parameters:
        ctx - the ChannelHandlerContext for which the connect operation is made.
        remoteAddress - the SocketAddress to which it should connect.
        localAddress - the SocketAddress which is used as source on connect.
        promise - the ChannelPromise to notify once the operation completes.
      • channelActive

        public void channelActive​(com.couchbase.client.core.deps.io.netty.channel.ChannelHandlerContext ctx)
        As soon as the channel is active start sending the request but also schedule a timeout properly.
        Specified by:
        channelActive in interface com.couchbase.client.core.deps.io.netty.channel.ChannelInboundHandler
        Overrides:
        channelActive in class com.couchbase.client.core.deps.io.netty.channel.ChannelInboundHandlerAdapter
        Parameters:
        ctx - the ChannelHandlerContext for which the channel active operation is made.
      • channelRead

        public void channelRead​(com.couchbase.client.core.deps.io.netty.channel.ChannelHandlerContext ctx,
                                Object msg)
        As soon as we get a response, turn it into a list of SASL mechanisms the server supports.

        If the server responds with an empty list this is an issue and as a result we need to fail the connection immediately.

        Specified by:
        channelRead in interface com.couchbase.client.core.deps.io.netty.channel.ChannelInboundHandler
        Overrides:
        channelRead in class com.couchbase.client.core.deps.io.netty.channel.ChannelInboundHandlerAdapter
        Parameters:
        ctx - the ChannelHandlerContext for which the channel read operation is made.
        msg - the incoming msg that needs to be parsed.
      • exceptionCaught

        public void exceptionCaught​(com.couchbase.client.core.deps.io.netty.channel.ChannelHandlerContext ctx,
                                    Throwable cause)
        If there is an exception raised while we are waiting for our connect phase to complete, the error should be propagated as a cause up the pipeline.

        One reason for example could be TLS problems that need to be surfaced up the stack properly.

        Specified by:
        exceptionCaught in interface com.couchbase.client.core.deps.io.netty.channel.ChannelHandler
        Specified by:
        exceptionCaught in interface com.couchbase.client.core.deps.io.netty.channel.ChannelInboundHandler
        Overrides:
        exceptionCaught in class com.couchbase.client.core.deps.io.netty.channel.ChannelInboundHandlerAdapter
        Parameters:
        ctx - the channel handler context.
        cause - the cause of the problem.