Class SaslImpl
- java.lang.Object
-
- org.apache.qpid.proton.engine.impl.SaslImpl
-
- All Implemented Interfaces:
SaslFrameBody.SaslFrameBodyHandler<java.lang.Void>
,TransportLayer
,Sasl
public class SaslImpl extends java.lang.Object implements Sasl, SaslFrameBody.SaslFrameBodyHandler<java.lang.Void>, TransportLayer
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.qpid.proton.engine.Sasl
Sasl.SaslOutcome, Sasl.SaslState
-
-
Field Summary
Fields Modifier and Type Field Description static byte
SASL_FRAME_TYPE
-
Fields inherited from interface org.apache.qpid.proton.engine.Sasl
PN_SASL_AUTH, PN_SASL_NONE, PN_SASL_OK, PN_SASL_PERM, PN_SASL_SKIPPED, PN_SASL_SYS, PN_SASL_TEMP
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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)
-
-
-
Field Detail
-
SASL_FRAME_TYPE
public static final byte SASL_FRAME_TYPE
- See Also:
- Constant Field Values
-
-
Method Detail
-
isDone
public boolean isDone()
-
recv
public final int recv(byte[] bytes, int offset, int size)
Description copied from interface:Sasl
Read challenge/response/additional data sent from the peer. Use pending to determine the size of the data.
-
send
public final int send(byte[] bytes, int offset, int size)
Description copied from interface:Sasl
Send challenge/response/additional data to the peer.
-
pending
public int pending()
Description copied from interface:Sasl
Determine the size of the bytes available via recv(). Returns the size in bytes available via recv().
-
getState
public Sasl.SaslState getState()
Description copied from interface:Sasl
Access the current state of the layer.
-
setMechanisms
public void setMechanisms(java.lang.String... mechanisms)
Description copied from interface:Sasl
Set the acceptable SASL mechanisms for the layer.- Specified by:
setMechanisms
in interfaceSasl
- Parameters:
mechanisms
- a list of acceptable SASL mechanisms
-
getRemoteMechanisms
public java.lang.String[] getRemoteMechanisms()
Description copied from interface:Sasl
Retrieve the list of SASL mechanisms provided by the remote.- Specified by:
getRemoteMechanisms
in interfaceSasl
- Returns:
- the SASL mechanisms advertised by the remote
-
setMechanism
public void setMechanism(Symbol mechanism)
-
getChosenMechanism
public Symbol getChosenMechanism()
-
setResponse
public void setResponse(Binary initialResponse)
-
handle
public void handle(SaslFrameBody frameBody, Binary payload)
-
handleInit
public void handleInit(SaslInit saslInit, Binary payload, java.lang.Void context)
- Specified by:
handleInit
in interfaceSaslFrameBody.SaslFrameBodyHandler<java.lang.Void>
-
handleResponse
public void handleResponse(SaslResponse saslResponse, Binary payload, java.lang.Void context)
- Specified by:
handleResponse
in interfaceSaslFrameBody.SaslFrameBodyHandler<java.lang.Void>
-
done
public void done(Sasl.SaslOutcome outcome)
Description copied from interface:Sasl
Set the outcome of SASL negotiation Used by the server to set the result of the negotiation process.
-
handleMechanisms
public void handleMechanisms(SaslMechanisms saslMechanisms, Binary payload, java.lang.Void context)
- Specified by:
handleMechanisms
in interfaceSaslFrameBody.SaslFrameBodyHandler<java.lang.Void>
-
handleChallenge
public void handleChallenge(SaslChallenge saslChallenge, Binary payload, java.lang.Void context)
- Specified by:
handleChallenge
in interfaceSaslFrameBody.SaslFrameBodyHandler<java.lang.Void>
-
handleOutcome
public void handleOutcome(SaslOutcome saslOutcome, Binary payload, java.lang.Void context)
- Specified by:
handleOutcome
in interfaceSaslFrameBody.SaslFrameBodyHandler<java.lang.Void>
-
plain
public void plain(java.lang.String username, java.lang.String password)
Description copied from interface:Sasl
Configure the SASL layer to use the "PLAIN" mechanism. A utility function to configure a simple client SASL layer using PLAIN authentication.
-
getOutcome
public Sasl.SaslOutcome getOutcome()
Description copied from interface:Sasl
Retrieve the outcome of SASL negotiation.- Specified by:
getOutcome
in interfaceSasl
-
allowSkip
public void allowSkip(boolean allowSkip)
Description copied from interface:Sasl
Set whether servers may accept incoming connections that skip the SASL layer negotiation.
-
wrap
public TransportWrapper wrap(TransportInput input, TransportOutput output)
- Specified by:
wrap
in interfaceTransportLayer
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
getHostname
public java.lang.String getHostname()
Description copied from interface:Sasl
Retrieve the hostname indicated by the client when sending its SaslInit.- Specified by:
getHostname
in interfaceSasl
- Returns:
- the hostname indicated by the remote client, or null if none specified.
-
setRemoteHostname
public void setRemoteHostname(java.lang.String hostname)
Description copied from interface:Sasl
Set the remote hostname to indicate the host being connected to when sending a SaslInit to the server.- Specified by:
setRemoteHostname
in interfaceSasl
-
setListener
public void setListener(SaslListener saslListener)
Description copied from interface:Sasl
Adds a listener to receive notice of frames having arrived.- Specified by:
setListener
in interfaceSasl
-
-