Package org.apache.thrift.transport.sasl
Class ServerSaslPeer
java.lang.Object
org.apache.thrift.transport.sasl.ServerSaslPeer
- All Implemented Interfaces:
SaslPeer
Server side sasl peer, a wrapper around SaslServer to provide some handy methods.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddispose()Close this peer and release resources.byte[]evaluate(byte[] negotiationMessage) Evaluate and validate the negotiation message (response/challenge) received from peer.booleanbooleanThis method can only be called when the negotiation is complete (isAuthenticated returns true).byte[]unwrap(byte[] data, int offset, int length) Unwrap protected data to raw bytes.byte[]wrap(byte[] data, int offset, int length) Wrap raw bytes to protect it.
-
Constructor Details
-
ServerSaslPeer
-
-
Method Details
-
evaluate
Description copied from interface:SaslPeerEvaluate and validate the negotiation message (response/challenge) received from peer.- Specified by:
evaluatein interfaceSaslPeer- Parameters:
negotiationMessage- response/challenge received from peer.- Returns:
- new response/challenge to send to peer, can be null if authentication becomes success.
- Throws:
TSaslNegotiationException- if sasl authentication fails.
-
isAuthenticated
public boolean isAuthenticated()- Specified by:
isAuthenticatedin interfaceSaslPeer- Returns:
- true if authentication is done.
-
isDataProtected
public boolean isDataProtected()Description copied from interface:SaslPeerThis method can only be called when the negotiation is complete (isAuthenticated returns true). Otherwise it will throw IllegalStateExceptiion.- Specified by:
isDataProtectedin interfaceSaslPeer- Returns:
- if the qop requires some integrity/confidential protection.
-
wrap
Description copied from interface:SaslPeerWrap raw bytes to protect it.- Specified by:
wrapin interfaceSaslPeer- Parameters:
data- raw bytes.offset- the start position of the content to wrap.length- the length of the content to wrap.- Returns:
- bytes with protection to send to peer.
- Throws:
TTransportException- if failure.
-
unwrap
Description copied from interface:SaslPeerUnwrap protected data to raw bytes.- Specified by:
unwrapin interfaceSaslPeer- Parameters:
data- protected data received from peer.offset- the start position of the content to unwrap.length- the length of the content to unwrap.- Returns:
- raw bytes.
- Throws:
TTransportException- if failed.
-
dispose
public void dispose()Description copied from interface:SaslPeerClose this peer and release resources.
-