use of com.couchbase.client.core.cnc.events.io.SaslMechanismsSelectedEvent in project couchbase-jvm-clients by couchbase.
the class SaslAuthenticationHandler method startAuthSequence.
/**
* Starts the SASL auth sequence with the set of mechanisms that are valid for this specific run.
*
* @param ctx the channel handler context
* @param usedMechanisms the mechanisms that can be used during this run
*/
private void startAuthSequence(final ChannelHandlerContext ctx, final Set<SaslMechanism> usedMechanisms) {
try {
saslClient = createSaslClient(usedMechanisms);
SaslMechanism selectedMechanism = SaslMechanism.from(saslClient.getMechanismName());
roundtripsToGo = selectedMechanism.roundtrips();
endpointContext.environment().eventBus().publish(new SaslMechanismsSelectedEvent(ioContext, usedMechanisms, selectedMechanism));
ctx.writeAndFlush(buildAuthRequest(ctx));
maybePropagateChannelActive(ctx);
} catch (SaslException e) {
failConnect(ctx, "SASL Client could not be constructed", null, e, (short) 0);
}
}
Aggregations