Package org.apache.hadoop.security
Class SaslRpcClient
java.lang.Object
org.apache.hadoop.security.SaslRpcClient
A utility class that encapsulates SASL logic for RPC client
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionSaslRpcClient(UserGroupInformation ugi, Class<?> protocol, InetSocketAddress serverAddr, Configuration conf) Create a SaslRpcClient that can be used by a RPC client to negotiate SASL authentication with a RPC server -
Method Summary
Modifier and TypeMethodDescriptionvoiddispose()Release resources used by wrapped saslClient.Get SASL wrapped InputStream if SASL QoP requires unwrapping, otherwise return original stream.Get SASL wrapped OutputStream if SASL QoP requires wrapping, otherwise return original stream.saslConnect(Client.IpcStreams ipcStreams) Do client side SASL authentication with server via the given IpcStreams.
-
Field Details
-
LOG
public static final org.slf4j.Logger LOG
-
-
Constructor Details
-
SaslRpcClient
public SaslRpcClient(UserGroupInformation ugi, Class<?> protocol, InetSocketAddress serverAddr, Configuration conf) Create a SaslRpcClient that can be used by a RPC client to negotiate SASL authentication with a RPC server- Parameters:
ugi- - connecting userprotocol- - RPC protocolserverAddr- - InetSocketAddress of remote serverconf- - Configuration
-
-
Method Details
-
getNegotiatedProperty
-
getAuthMethod
-
saslConnect
Do client side SASL authentication with server via the given IpcStreams.- Parameters:
ipcStreams- ipcStreams.- Returns:
- AuthMethod used to negotiate the connection
- Throws:
IOException- raised on errors performing I/O.
-
getInputStream
Get SASL wrapped InputStream if SASL QoP requires unwrapping, otherwise return original stream. Can be called only after saslConnect() has been called.- Parameters:
in- - InputStream used to make the connection- Returns:
- InputStream that may be using SASL unwrap
- Throws:
IOException- raised on errors performing I/O.
-
getOutputStream
Get SASL wrapped OutputStream if SASL QoP requires wrapping, otherwise return original stream. Can be called only after saslConnect() has been called.- Parameters:
out- - OutputStream used to make the connection- Returns:
- OutputStream that may be using wrapping
- Throws:
IOException- raised on errors performing I/O.
-
dispose
Release resources used by wrapped saslClient.- Throws:
SaslException- if authentication or generating response fails, or SASL protocol mixup
-