SaslHandler Interface

public interface SaslHandler

Interface definition for what client events are expected to be handled during Sasl negotiation

Method Summary

Modifier and Type Method and Description
String chooseSaslMechanism(String[] mechanisms)

Handle the provided mechanisms and return the mechanism to be used from a provided list

byte [] getInitPayload(String chosenMechanism)

Based on the chosen mechanism, builds and returns the bytes to be sent in the payload for the Sasl init message

String getPlainPassword()
String getPlainUsername()
byte [] handleChallenge(byte[] saslChallenge)

Handles a given challenge and returns the bytes to be sent in the payload of the Sasl response message

void handleOutcome(SaslOutcome outcome)

Handles what to do upon the Sasl negotiation finishing.

void setSasToken(String sasToken)

Method Details

chooseSaslMechanism

public String chooseSaslMechanism(String[] mechanisms)

Handle the provided mechanisms and return the mechanism to be used from a provided list

Parameters:

mechanisms - A list of available Sasl Mechanisms offered by the service

Returns:

the mechanism to use

Throws:

Exception - if sasl negotiation fails

getInitPayload

public byte [] getInitPayload(String chosenMechanism)

Based on the chosen mechanism, builds and returns the bytes to be sent in the payload for the Sasl init message

Parameters:

chosenMechanism - the sasl mechanism that was chosen

Returns:

the bytes to be used as the paylaod for the Sasl init message

getPlainPassword

public String getPlainPassword()

getPlainUsername

public String getPlainUsername()

handleChallenge

public byte [] handleChallenge(byte[] saslChallenge)

Handles a given challenge and returns the bytes to be sent in the payload of the Sasl response message

Parameters:

saslChallenge - The bytes from the Sasl challenge received from the service

Returns:

the bytes to be sent in the payload of the Sasl response to the provided challenge

Throws:

Exception - if sasl negotiation fails

handleOutcome

public void handleOutcome(SaslOutcome outcome)

Handles what to do upon the Sasl negotiation finishing.

Parameters:

outcome - The outcome of the sasl negotiation

Throws:

Exception - if sasl negotiation fails

setSasToken

public void setSasToken(String sasToken)

Parameters:

sasToken

Applies to