Package org.apache.thrift.transport.sasl
Class ServerSaslPeer
- java.lang.Object
-
- org.apache.thrift.transport.sasl.ServerSaslPeer
-
-
Constructor Summary
Constructors Constructor Description ServerSaslPeer(javax.security.sasl.SaslServer saslServer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddispose()Close this peer and release resources.byte[]evaluate(byte[] negotiationMessage)Evaluate and validate the negotiation message (response/challenge) received from peer.booleanisAuthenticated()booleanisDataProtected()This 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.
-
-
-
Method Detail
-
evaluate
public byte[] evaluate(byte[] negotiationMessage) throws TSaslNegotiationExceptionDescription 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
public byte[] wrap(byte[] data, int offset, int length) throws TTransportExceptionDescription 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
public byte[] unwrap(byte[] data, int offset, int length) throws TTransportExceptionDescription 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.
-
-