Package org.apache.zookeeper.client
Class ZooKeeperSaslClient
- java.lang.Object
-
- org.apache.zookeeper.client.ZooKeeperSaslClient
-
public class ZooKeeperSaslClient extends java.lang.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 java.lang.String
ENABLE_CLIENT_SASL_DEFAULT
static java.lang.String
ENABLE_CLIENT_SASL_KEY
static java.lang.String
LOGIN_CONTEXT_NAME_KEY
-
Constructor Summary
Constructors Constructor Description ZooKeeperSaslClient(java.lang.String serverPrincipal)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
clientTunneledAuthenticationInProgress()
java.lang.String
getConfigStatus()
Watcher.Event.KeeperState
getKeeperState()
java.lang.String
getLoginContext()
ZooKeeperSaslClient.SaslState
getSaslState()
void
initialize(ClientCnxn cnxn)
boolean
isComplete()
static boolean
isEnabled()
Returns true if the SASL client is enabled.boolean
isFailed()
void
respondToServer(byte[] serverToken, ClientCnxn cnxn)
-
-
-
Field Detail
-
LOGIN_CONTEXT_NAME_KEY
public static final java.lang.String LOGIN_CONTEXT_NAME_KEY
- See Also:
- Constant Field Values
-
ENABLE_CLIENT_SASL_KEY
public static final java.lang.String ENABLE_CLIENT_SASL_KEY
- See Also:
- Constant Field Values
-
ENABLE_CLIENT_SASL_DEFAULT
public static final java.lang.String ENABLE_CLIENT_SASL_DEFAULT
- See Also:
- Constant Field Values
-
-
Method Detail
-
isEnabled
public static boolean isEnabled()
Returns 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:
- If the SASL client is enabled.
-
getSaslState
public ZooKeeperSaslClient.SaslState getSaslState()
-
getLoginContext
public java.lang.String getLoginContext()
-
getConfigStatus
public java.lang.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 javax.security.sasl.SaslException
- Throws:
javax.security.sasl.SaslException
-
clientTunneledAuthenticationInProgress
public boolean clientTunneledAuthenticationInProgress()
-
-