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 byteSASL_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 voidallowSkip(boolean allowSkip)Set whether servers may accept incoming connections that skip the SASL layer negotiation.voidclient()voiddone(Sasl.SaslOutcome outcome)Set the outcome of SASL negotiation Used by the server to set the result of the negotiation process.SymbolgetChosenMechanism()java.lang.StringgetHostname()Retrieve the hostname indicated by the client when sending its SaslInit.Sasl.SaslOutcomegetOutcome()Retrieve the outcome of SASL negotiation.java.lang.String[]getRemoteMechanisms()Retrieve the list of SASL mechanisms provided by the remote.Sasl.SaslStategetState()Access the current state of the layer.voidhandle(SaslFrameBody frameBody, Binary payload)voidhandleChallenge(SaslChallenge saslChallenge, Binary payload, java.lang.Void context)voidhandleInit(SaslInit saslInit, Binary payload, java.lang.Void context)voidhandleMechanisms(SaslMechanisms saslMechanisms, Binary payload, java.lang.Void context)voidhandleOutcome(SaslOutcome saslOutcome, Binary payload, java.lang.Void context)voidhandleResponse(SaslResponse saslResponse, Binary payload, java.lang.Void context)booleanisDone()intpending()Determine the size of the bytes available via recv().voidplain(java.lang.String username, java.lang.String password)Configure the SASL layer to use the "PLAIN" mechanism.intrecv(byte[] bytes, int offset, int size)Read challenge/response/additional data sent from the peer.intsend(byte[] bytes, int offset, int size)Send challenge/response/additional data to the peer.voidserver()voidsetListener(SaslListener saslListener)Adds a listener to receive notice of frames having arrived.voidsetMechanism(Symbol mechanism)voidsetMechanisms(java.lang.String... mechanisms)Set the acceptable SASL mechanisms for the layer.voidsetRemoteHostname(java.lang.String hostname)Set the remote hostname to indicate the host being connected to when sending a SaslInit to the server.voidsetResponse(Binary initialResponse)java.lang.StringtoString()TransportWrapperwrap(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:SaslRead 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:SaslSend challenge/response/additional data to the peer.
-
pending
public int pending()
Description copied from interface:SaslDetermine 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:SaslAccess the current state of the layer.
-
setMechanisms
public void setMechanisms(java.lang.String... mechanisms)
Description copied from interface:SaslSet the acceptable SASL mechanisms for the layer.- Specified by:
setMechanismsin interfaceSasl- Parameters:
mechanisms- a list of acceptable SASL mechanisms
-
getRemoteMechanisms
public java.lang.String[] getRemoteMechanisms()
Description copied from interface:SaslRetrieve the list of SASL mechanisms provided by the remote.- Specified by:
getRemoteMechanismsin 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:
handleInitin interfaceSaslFrameBody.SaslFrameBodyHandler<java.lang.Void>
-
handleResponse
public void handleResponse(SaslResponse saslResponse, Binary payload, java.lang.Void context)
- Specified by:
handleResponsein interfaceSaslFrameBody.SaslFrameBodyHandler<java.lang.Void>
-
done
public void done(Sasl.SaslOutcome outcome)
Description copied from interface:SaslSet 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:
handleMechanismsin interfaceSaslFrameBody.SaslFrameBodyHandler<java.lang.Void>
-
handleChallenge
public void handleChallenge(SaslChallenge saslChallenge, Binary payload, java.lang.Void context)
- Specified by:
handleChallengein interfaceSaslFrameBody.SaslFrameBodyHandler<java.lang.Void>
-
handleOutcome
public void handleOutcome(SaslOutcome saslOutcome, Binary payload, java.lang.Void context)
- Specified by:
handleOutcomein interfaceSaslFrameBody.SaslFrameBodyHandler<java.lang.Void>
-
plain
public void plain(java.lang.String username, java.lang.String password)Description copied from interface:SaslConfigure 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:SaslRetrieve the outcome of SASL negotiation.- Specified by:
getOutcomein interfaceSasl
-
allowSkip
public void allowSkip(boolean allowSkip)
Description copied from interface:SaslSet whether servers may accept incoming connections that skip the SASL layer negotiation.
-
wrap
public TransportWrapper wrap(TransportInput input, TransportOutput output)
- Specified by:
wrapin interfaceTransportLayer
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
getHostname
public java.lang.String getHostname()
Description copied from interface:SaslRetrieve the hostname indicated by the client when sending its SaslInit.- Specified by:
getHostnamein 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:SaslSet the remote hostname to indicate the host being connected to when sending a SaslInit to the server.- Specified by:
setRemoteHostnamein interfaceSasl
-
setListener
public void setListener(SaslListener saslListener)
Description copied from interface:SaslAdds a listener to receive notice of frames having arrived.- Specified by:
setListenerin interfaceSasl
-
-