本文整理汇总了Java中org.apache.zookeeper.client.ZooKeeperSaslClient.isEnabled方法的典型用法代码示例。如果您正苦于以下问题:Java ZooKeeperSaslClient.isEnabled方法的具体用法?Java ZooKeeperSaslClient.isEnabled怎么用?Java ZooKeeperSaslClient.isEnabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.zookeeper.client.ZooKeeperSaslClient
的用法示例。
在下文中一共展示了ZooKeeperSaslClient.isEnabled方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: clientTunneledAuthenticationInProgress
import org.apache.zookeeper.client.ZooKeeperSaslClient; //导入方法依赖的package包/类
public boolean clientTunneledAuthenticationInProgress() {
// 1. SASL client is disabled.
if (!ZooKeeperSaslClient.isEnabled()) {
return false;
}
// 2. SASL login failed.
if (saslLoginFailed == true) {
return false;
}
// 3. SendThread has not created the authenticating object yet,
// therefore authentication is (at the earliest stage of being) in progress.
if (zooKeeperSaslClient == null) {
return true;
}
// 4. authenticating object exists, so ask it for its progress.
return zooKeeperSaslClient.clientTunneledAuthenticationInProgress();
}
示例2: tunnelAuthInProgress
import org.apache.zookeeper.client.ZooKeeperSaslClient; //导入方法依赖的package包/类
public boolean tunnelAuthInProgress() {
// 1. SASL client is disabled.
if (!ZooKeeperSaslClient.isEnabled()) {
return false;
}
// 2. SASL login failed.
if (saslLoginFailed == true) {
return false;
}
// 3. SendThread has not created the authenticating object yet,
// therefore authentication is (at the earliest stage of being) in progress.
if (zooKeeperSaslClient == null) {
return true;
}
// 4. authenticating object exists, so ask it for its progress.
return zooKeeperSaslClient.clientTunneledAuthenticationInProgress();
}
示例3: startConnect
import org.apache.zookeeper.client.ZooKeeperSaslClient; //导入方法依赖的package包/类
private void startConnect() throws IOException {
state = States.CONNECTING;
InetSocketAddress addr;
if (rwServerAddress != null) {
addr = rwServerAddress;
rwServerAddress = null;
} else {
addr = hostProvider.next(1000);
}
setName(getName().replaceAll("\\(.*\\)",
"(" + addr.getHostName() + ":" + addr.getPort() + ")"));
if (ZooKeeperSaslClient.isEnabled()) {
try {
String principalUserName = System.getProperty(
ZK_SASL_CLIENT_USERNAME, "zookeeper");
zooKeeperSaslClient =
new ZooKeeperSaslClient(
principalUserName+"/"+addr.getHostName());
} catch (LoginException e) {
// An authentication error occurred when the SASL client tried to initialize:
// for Kerberos this means that the client failed to authenticate with the KDC.
// This is different from an authentication error that occurs during communication
// with the Zookeeper server, which is handled below.
LOG.warn("SASL configuration failed: " + e + " Will continue connection to Zookeeper server without "
+ "SASL authentication, if Zookeeper server allows it.");
eventThread.queueEvent(new WatchedEvent(
Watcher.Event.EventType.None,
Watcher.Event.KeeperState.AuthFailed, null));
saslLoginFailed = true;
}
}
logStartConnect(addr);
clientCnxnSocket.connect(addr);
}