# 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 enum`
`ZooKeeperSaslClient.SaslState`
`static class`
`ZooKeeperSaslClient.ServerSaslResponseCallback`

## Field Summary

Fields
Modifier and Type
Field
Description
`static final String`
`ENABLE_CLIENT_SASL_DEFAULT`
Deprecated.
Use `ZKClientConfig.ENABLE_CLIENT_SASL_DEFAULT` instead.
`static final String`
`ENABLE_CLIENT_SASL_KEY`
Deprecated.
Use `ZKClientConfig.ENABLE_CLIENT_SASL_KEY` instead.
`static final String`
`LOGIN_CONTEXT_NAME_KEY`
Deprecated.
Use `ZKClientConfig.LOGIN_CONTEXT_NAME_KEY` instead.

## Constructor Summary

Constructors
Constructor
Description
`ZooKeeperSaslClient(String serverPrincipal, ZKClientConfig clientConfig, AtomicReference<Login> loginRef)`

## Method Summary

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.
Use `ZKClientConfig.isSaslClientEnabled()` instead
`boolean`
`isFailed()`
`void`
`respondToServer(byte[] serverToken, ClientCnxn cnxn)`

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### LOGIN_CONTEXT_NAME_KEY

@Deprecated public static final String LOGIN_CONTEXT_NAME_KEY
Deprecated.
Use `ZKClientConfig.LOGIN_CONTEXT_NAME_KEY` instead.

See Also:
  - Constant Field Values

### ENABLE_CLIENT_SASL_KEY

@Deprecated public static final String ENABLE_CLIENT_SASL_KEY
Deprecated.
Use `ZKClientConfig.ENABLE_CLIENT_SASL_KEY` instead.

See Also:
  - Constant Field Values

### ENABLE_CLIENT_SASL_DEFAULT

@Deprecated public static final String ENABLE_CLIENT_SASL_DEFAULT
Deprecated.
Use `ZKClientConfig.ENABLE_CLIENT_SASL_DEFAULT` instead.

See Also:
  - Constant Field Values

## Constructor Details

### ZooKeeperSaslClient

public ZooKeeperSaslClient(String serverPrincipal, ZKClientConfig clientConfig, AtomicReference<Login> loginRef) throws LoginException

Throws:
  `LoginException`

## Method Details

### isEnabled

@Deprecated public static boolean isEnabled()
Deprecated.
Use `ZKClientConfig.isSaslClientEnabled()` instead
Returns true if the SASL client is enabled. By default, the client is enabled but can be disabled by setting the system property `zookeeper.sasl.client` to `false`. 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()