Package org.apache.zookeeper.client
Class ZooKeeperSaslClient
- java.lang.Object
-
- org.apache.zookeeper.client.ZooKeeperSaslClient
-
public class ZooKeeperSaslClient extends Object
This class manages SASL authentication for the client. It allows ClientCnxn to authenticate using SASL with a ZooKeeper server.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ZooKeeperSaslClient.SaslState
static class
ZooKeeperSaslClient.ServerSaslResponseCallback
-
Field Summary
Fields Modifier and Type Field Description static String
ENABLE_CLIENT_SASL_DEFAULT
Deprecated.UseZKClientConfig.ENABLE_CLIENT_SASL_DEFAULT
instead.static String
ENABLE_CLIENT_SASL_KEY
Deprecated.UseZKClientConfig.ENABLE_CLIENT_SASL_KEY
instead.static String
LOGIN_CONTEXT_NAME_KEY
Deprecated.UseZKClientConfig.LOGIN_CONTEXT_NAME_KEY
instead.
-
Constructor Summary
Constructors Constructor Description ZooKeeperSaslClient(String serverPrincipal, ZKClientConfig clientConfig)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description boolean
clientTunneledAuthenticationInProgress()
String
getConfigStatus()
Watcher.Event.KeeperState
getKeeperState()
String
getLoginContext()
ZooKeeperSaslClient.SaslState
getSaslState()
void
initialize(ClientCnxn cnxn)
boolean
isComplete()
static boolean
isEnabled()
Deprecated.UseZKClientConfig.isSaslClientEnabled()
insteadboolean
isFailed()
void
respondToServer(byte[] serverToken, ClientCnxn cnxn)
void
shutdown()
close login thread if running
-
-
-
Field Detail
-
LOGIN_CONTEXT_NAME_KEY
@Deprecated public static final String LOGIN_CONTEXT_NAME_KEY
Deprecated.UseZKClientConfig.LOGIN_CONTEXT_NAME_KEY
instead.- See Also:
- Constant Field Values
-
ENABLE_CLIENT_SASL_KEY
@Deprecated public static final String ENABLE_CLIENT_SASL_KEY
Deprecated.UseZKClientConfig.ENABLE_CLIENT_SASL_KEY
instead.- See Also:
- Constant Field Values
-
ENABLE_CLIENT_SASL_DEFAULT
@Deprecated public static final String ENABLE_CLIENT_SASL_DEFAULT
Deprecated.UseZKClientConfig.ENABLE_CLIENT_SASL_DEFAULT
instead.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ZooKeeperSaslClient
public ZooKeeperSaslClient(String serverPrincipal, ZKClientConfig clientConfig) throws LoginException
- Throws:
LoginException
-
-
Method Detail
-
isEnabled
@Deprecated public static boolean isEnabled()
Deprecated.UseZKClientConfig.isSaslClientEnabled()
insteadReturns true if the SASL client is enabled. By default, the client is enabled but can be disabled by setting the system propertyzookeeper.sasl.client
tofalse
. See ZOOKEEPER-1657 for more information.- Returns:
- true if the SASL client is enabled.
-
getSaslState
public ZooKeeperSaslClient.SaslState getSaslState()
-
getLoginContext
public String getLoginContext()
-
getConfigStatus
public String getConfigStatus()
- Returns:
- informational message indicating the current configuration status.
-
isComplete
public boolean isComplete()
-
isFailed
public boolean isFailed()
-
respondToServer
public void respondToServer(byte[] serverToken, ClientCnxn cnxn)
-
getKeeperState
public Watcher.Event.KeeperState getKeeperState()
-
initialize
public void initialize(ClientCnxn cnxn) throws SaslException
- Throws:
SaslException
-
clientTunneledAuthenticationInProgress
public boolean clientTunneledAuthenticationInProgress()
-
shutdown
public void shutdown()
close login thread if running
-
-