public class SaslAuthenticationHandler extends com.couchbase.client.core.deps.io.netty.channel.ChannelDuplexHandler implements CallbackHandler
SASL is a complicated back-and-forth protocol which involves potentially many steps depending on the mechanism used. Couchbase supports a variety of protocols depending on the version, so the first step is to actually ask the server for the types of procotols it supports. Once the client has this figured out, it initializes the SASL client and starts the "back and forth" challenge response protocol. All of this opaque payload is framed over the memcache binary protocol as usual.
Through configuration it is possible to change some defaults, for example limit the types of protocols accepted.
| Constructor and Description |
|---|
SaslAuthenticationHandler(EndpointContext endpointContext,
String username,
String password,
Set<SaslMechanism> allowedSaslMechanisms) |
| Modifier and Type | Method and Description |
|---|---|
Set<SaslMechanism> |
allowedMechanisms()
Returns the allowed mechanisms for this handler, useful for testing assertions.
|
void |
channelActive(com.couchbase.client.core.deps.io.netty.channel.ChannelHandlerContext ctx) |
void |
channelRead(com.couchbase.client.core.deps.io.netty.channel.ChannelHandlerContext ctx,
Object msg) |
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 |
handle(Callback[] callbacks)
This SASL callback handler is used to call certain callbacks during the
authentication phases (to set the name and password if required).
|
bind, close, deregister, disconnect, flush, read, writechannelInactive, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaught, userEventTriggeredensureNotSharable, handlerAdded, handlerRemoved, isSharablepublic SaslAuthenticationHandler(EndpointContext endpointContext, String username, String password, Set<SaslMechanism> allowedSaslMechanisms)
@Stability.Internal public Set<SaslMechanism> allowedMechanisms()
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)
connect in interface com.couchbase.client.core.deps.io.netty.channel.ChannelOutboundHandlerconnect in class com.couchbase.client.core.deps.io.netty.channel.ChannelDuplexHandlerctx - 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.public void channelActive(com.couchbase.client.core.deps.io.netty.channel.ChannelHandlerContext ctx)
channelActive in interface com.couchbase.client.core.deps.io.netty.channel.ChannelInboundHandlerchannelActive in class com.couchbase.client.core.deps.io.netty.channel.ChannelInboundHandlerAdapterpublic void channelRead(com.couchbase.client.core.deps.io.netty.channel.ChannelHandlerContext ctx,
Object msg)
channelRead in interface com.couchbase.client.core.deps.io.netty.channel.ChannelInboundHandlerchannelRead in class com.couchbase.client.core.deps.io.netty.channel.ChannelInboundHandlerAdapterpublic void handle(Callback[] callbacks) throws UnsupportedCallbackException
handle in interface CallbackHandlercallbacks - the callbacks to handle.UnsupportedCallbackExceptionCopyright © 2021 Couchbase, Inc.. All rights reserved.