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 |
---|---|
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, write
channelInactive, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaught, userEventTriggered
ensureNotSharable, handlerAdded, handlerRemoved, isSharable
public SaslAuthenticationHandler(EndpointContext endpointContext, String username, String password, Set<SaslMechanism> allowedSaslMechanisms)
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.ChannelOutboundHandler
connect
in class com.couchbase.client.core.deps.io.netty.channel.ChannelDuplexHandler
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.public void channelActive(com.couchbase.client.core.deps.io.netty.channel.ChannelHandlerContext ctx)
channelActive
in interface com.couchbase.client.core.deps.io.netty.channel.ChannelInboundHandler
channelActive
in class com.couchbase.client.core.deps.io.netty.channel.ChannelInboundHandlerAdapter
public 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.ChannelInboundHandler
channelRead
in class com.couchbase.client.core.deps.io.netty.channel.ChannelInboundHandlerAdapter
public void handle(Callback[] callbacks) throws UnsupportedCallbackException
handle
in interface CallbackHandler
callbacks
- the callbacks to handle.UnsupportedCallbackException
Copyright © 2020 Couchbase, Inc.. All rights reserved.