public class KeyValueAuthHandler extends SimpleChannelInboundHandler<FullBinaryMemcacheResponse> implements CallbackHandler, ChannelOutboundHandler
A SASL Client which communicates through the memcache binary protocol.
ChannelHandler.Sharable| Modifier and Type | Field and Description |
|---|---|
static byte |
SASL_LIST_MECHS_OPCODE
The memcache opcode for the SASL mechs list.
|
| Constructor and Description |
|---|
KeyValueAuthHandler(String username,
String password)
Creates a new
KeyValueAuthHandler. |
| Modifier and Type | Method and Description |
|---|---|
void |
bind(ChannelHandlerContext ctx,
SocketAddress localAddress,
ChannelPromise promise) |
void |
channelActive(ChannelHandlerContext ctx)
Once the channel is marked as active, the SASL negotiation is started.
|
protected void |
channelRead0(ChannelHandlerContext ctx,
FullBinaryMemcacheResponse msg)
Dispatches incoming SASL responses to the appropriate handler methods.
|
void |
close(ChannelHandlerContext ctx,
ChannelPromise promise) |
void |
connect(ChannelHandlerContext ctx,
SocketAddress remoteAddress,
SocketAddress localAddress,
ChannelPromise promise) |
void |
deregister(ChannelHandlerContext ctx,
ChannelPromise promise) |
void |
disconnect(ChannelHandlerContext ctx,
ChannelPromise promise) |
void |
flush(ChannelHandlerContext ctx) |
void |
handle(Callback[] callbacks)
Callback handler needed for the
SaslClient which supplies username and password. |
void |
read(ChannelHandlerContext ctx) |
void |
write(ChannelHandlerContext ctx,
Object msg,
ChannelPromise promise) |
acceptInboundMessage, channelReadchannelInactive, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaught, userEventTriggeredhandlerAdded, handlerRemoved, isSharableclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitexceptionCaught, handlerAdded, handlerRemovedpublic static final byte SASL_LIST_MECHS_OPCODE
The memcache opcode for the SASL mechs list.
public KeyValueAuthHandler(String username, String password)
Creates a new KeyValueAuthHandler.
username - the name of the user/bucket.password - the password associated with the user/bucket.public void channelActive(ChannelHandlerContext ctx) throws Exception
Once the channel is marked as active, the SASL negotiation is started.
channelActive in interface ChannelInboundHandlerchannelActive in class ChannelInboundHandlerAdapterctx - the handler context.Exception - if something goes wrong during negotiation.public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException
Callback handler needed for the SaslClient which supplies username and password.
handle in interface CallbackHandlercallbacks - the possible callbacks.IOException - if something goes wrong during negotiation.UnsupportedCallbackException - if something goes wrong during negotiation.protected void channelRead0(ChannelHandlerContext ctx, FullBinaryMemcacheResponse msg) throws Exception
Dispatches incoming SASL responses to the appropriate handler methods.
channelRead0 in class SimpleChannelInboundHandler<FullBinaryMemcacheResponse>ctx - the handler context.msg - the incoming message to investigate.Exception - if something goes wrong during negotiation.public void bind(ChannelHandlerContext ctx, SocketAddress localAddress, ChannelPromise promise) throws Exception
bind in interface ChannelOutboundHandlerExceptionpublic void connect(ChannelHandlerContext ctx, SocketAddress remoteAddress, SocketAddress localAddress, ChannelPromise promise) throws Exception
connect in interface ChannelOutboundHandlerExceptionpublic void disconnect(ChannelHandlerContext ctx, ChannelPromise promise) throws Exception
disconnect in interface ChannelOutboundHandlerExceptionpublic void close(ChannelHandlerContext ctx, ChannelPromise promise) throws Exception
close in interface ChannelOutboundHandlerExceptionpublic void deregister(ChannelHandlerContext ctx, ChannelPromise promise) throws Exception
deregister in interface ChannelOutboundHandlerExceptionpublic void read(ChannelHandlerContext ctx) throws Exception
read in interface ChannelOutboundHandlerExceptionpublic void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception
write in interface ChannelOutboundHandlerExceptionpublic void flush(ChannelHandlerContext ctx) throws Exception
flush in interface ChannelOutboundHandlerExceptionCopyright © 2016 Couchbase, Inc.. All rights reserved.