Class SaslListMechanismsHandler
- java.lang.Object
-
- com.couchbase.client.core.deps.io.netty.channel.ChannelHandlerAdapter
-
- com.couchbase.client.core.deps.io.netty.channel.ChannelInboundHandlerAdapter
-
- com.couchbase.client.core.deps.io.netty.channel.ChannelDuplexHandler
-
- com.couchbase.client.core.io.netty.kv.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
TheSaslListMechanismsHandlerasks 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.
-
-
Constructor Summary
Constructors Constructor Description SaslListMechanismsHandler(EndpointContext endpointContext)Creates a newSaslListMechanismsHandler.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidchannelActive(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.voidchannelRead(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.voidconnect(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.voidexceptionCaught(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
-
-
-
-
Constructor Detail
-
SaslListMechanismsHandler
public SaslListMechanismsHandler(EndpointContext endpointContext)
Creates a newSaslListMechanismsHandler.- 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:
connectin interfacecom.couchbase.client.core.deps.io.netty.channel.ChannelOutboundHandler- Overrides:
connectin classcom.couchbase.client.core.deps.io.netty.channel.ChannelDuplexHandler- Parameters:
ctx- theChannelHandlerContextfor which the connect operation is made.remoteAddress- theSocketAddressto which it should connect.localAddress- theSocketAddresswhich is used as source on connect.promise- theChannelPromiseto 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:
channelActivein interfacecom.couchbase.client.core.deps.io.netty.channel.ChannelInboundHandler- Overrides:
channelActivein classcom.couchbase.client.core.deps.io.netty.channel.ChannelInboundHandlerAdapter- Parameters:
ctx- theChannelHandlerContextfor 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:
channelReadin interfacecom.couchbase.client.core.deps.io.netty.channel.ChannelInboundHandler- Overrides:
channelReadin classcom.couchbase.client.core.deps.io.netty.channel.ChannelInboundHandlerAdapter- Parameters:
ctx- theChannelHandlerContextfor 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:
exceptionCaughtin interfacecom.couchbase.client.core.deps.io.netty.channel.ChannelHandler- Specified by:
exceptionCaughtin interfacecom.couchbase.client.core.deps.io.netty.channel.ChannelInboundHandler- Overrides:
exceptionCaughtin classcom.couchbase.client.core.deps.io.netty.channel.ChannelInboundHandlerAdapter- Parameters:
ctx- the channel handler context.cause- the cause of the problem.
-
-