public class SaslImpl extends java.lang.Object implements Sasl, SaslFrameBody.SaslFrameBodyHandler<java.lang.Void>, TransportLayer
Sasl.SaslOutcome, Sasl.SaslState
Modifier and Type | Field and Description |
---|---|
static byte |
SASL_FRAME_TYPE |
PN_SASL_AUTH, PN_SASL_NONE, PN_SASL_OK, PN_SASL_PERM, PN_SASL_SKIPPED, PN_SASL_SYS, PN_SASL_TEMP
Modifier and Type | Method and Description |
---|---|
void |
allowSkip(boolean allowSkip)
Set whether servers may accept incoming connections
that skip the SASL layer negotiation.
|
void |
client() |
void |
done(Sasl.SaslOutcome outcome)
Set the outcome of SASL negotiation
Used by the server to set the result of the negotiation process.
|
Symbol |
getChosenMechanism() |
java.lang.String |
getHostname()
Retrieve the hostname indicated by the client when sending its SaslInit.
|
Sasl.SaslOutcome |
getOutcome()
Retrieve the outcome of SASL negotiation.
|
java.lang.String[] |
getRemoteMechanisms()
Retrieve the list of SASL mechanisms provided by the remote.
|
Sasl.SaslState |
getState()
Access the current state of the layer.
|
void |
handle(SaslFrameBody frameBody,
Binary payload) |
void |
handleChallenge(SaslChallenge saslChallenge,
Binary payload,
java.lang.Void context) |
void |
handleInit(SaslInit saslInit,
Binary payload,
java.lang.Void context) |
void |
handleMechanisms(SaslMechanisms saslMechanisms,
Binary payload,
java.lang.Void context) |
void |
handleOutcome(SaslOutcome saslOutcome,
Binary payload,
java.lang.Void context) |
void |
handleResponse(SaslResponse saslResponse,
Binary payload,
java.lang.Void context) |
boolean |
isDone() |
int |
pending()
Determine the size of the bytes available via recv().
|
void |
plain(java.lang.String username,
java.lang.String password)
Configure the SASL layer to use the "PLAIN" mechanism.
|
int |
recv(byte[] bytes,
int offset,
int size)
Read challenge/response/additional data sent from the peer.
|
int |
send(byte[] bytes,
int offset,
int size)
Send challenge/response/additional data to the peer.
|
void |
server() |
void |
setListener(SaslListener saslListener)
Adds a listener to receive notice of frames having arrived.
|
void |
setMechanism(Symbol mechanism) |
void |
setMechanisms(java.lang.String... mechanisms)
Set the acceptable SASL mechanisms for the layer.
|
void |
setRemoteHostname(java.lang.String hostname)
Set the remote hostname to indicate the host being connected to when
sending a SaslInit to the server.
|
void |
setResponse(Binary initialResponse) |
java.lang.String |
toString() |
TransportWrapper |
wrap(TransportInput input,
TransportOutput output) |
public static final byte SASL_FRAME_TYPE
public boolean isDone()
public final int recv(byte[] bytes, int offset, int size)
Sasl
public final int send(byte[] bytes, int offset, int size)
Sasl
public int pending()
Sasl
public Sasl.SaslState getState()
Sasl
public void setMechanisms(java.lang.String... mechanisms)
Sasl
setMechanisms
in interface Sasl
mechanisms
- a list of acceptable SASL mechanismspublic java.lang.String[] getRemoteMechanisms()
Sasl
getRemoteMechanisms
in interface Sasl
public void setMechanism(Symbol mechanism)
public Symbol getChosenMechanism()
public void setResponse(Binary initialResponse)
public void handle(SaslFrameBody frameBody, Binary payload)
public void handleInit(SaslInit saslInit, Binary payload, java.lang.Void context)
handleInit
in interface SaslFrameBody.SaslFrameBodyHandler<java.lang.Void>
public void handleResponse(SaslResponse saslResponse, Binary payload, java.lang.Void context)
handleResponse
in interface SaslFrameBody.SaslFrameBodyHandler<java.lang.Void>
public void done(Sasl.SaslOutcome outcome)
Sasl
public void handleMechanisms(SaslMechanisms saslMechanisms, Binary payload, java.lang.Void context)
handleMechanisms
in interface SaslFrameBody.SaslFrameBodyHandler<java.lang.Void>
public void handleChallenge(SaslChallenge saslChallenge, Binary payload, java.lang.Void context)
handleChallenge
in interface SaslFrameBody.SaslFrameBodyHandler<java.lang.Void>
public void handleOutcome(SaslOutcome saslOutcome, Binary payload, java.lang.Void context)
handleOutcome
in interface SaslFrameBody.SaslFrameBodyHandler<java.lang.Void>
public void plain(java.lang.String username, java.lang.String password)
Sasl
public Sasl.SaslOutcome getOutcome()
Sasl
getOutcome
in interface Sasl
public void allowSkip(boolean allowSkip)
Sasl
public TransportWrapper wrap(TransportInput input, TransportOutput output)
wrap
in interface TransportLayer
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String getHostname()
Sasl
getHostname
in interface Sasl
public void setRemoteHostname(java.lang.String hostname)
Sasl
setRemoteHostname
in interface Sasl
public void setListener(SaslListener saslListener)
Sasl
setListener
in interface Sasl