作者:mobiledu2502868917 | 来源:互联网 | 2023-08-10 16:49
本文整理了Java中org.apache.storm.utils.Utils.isZkAuthenticationConfiguredTopology()方法的一些代码
本文整理了Java中org.apache.storm.utils.Utils.isZkAuthenticationConfiguredTopology()
方法的一些代码示例,展示了Utils.isZkAuthenticationConfiguredTopology()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utils.isZkAuthenticationConfiguredTopology()
方法的具体详情如下:
包路径:org.apache.storm.utils.Utils
类名称:Utils
方法名:isZkAuthenticationConfiguredTopology
[英]Is the topology configured to have ZooKeeper authentication.
[中]拓扑配置为具有ZooKeeper身份验证。
代码示例
代码示例来源:origin: apache/storm
/**
* Get the ZK ACLs that a worker should use when writing to ZK.
*
* @param conf the config for the topology.
* @return the ACLs
*/
public static List getWorkerACL(Map conf) {
if (!isZkAuthenticationConfiguredTopology(conf)) {
return null;
}
ArrayList ret = new ArrayList<>(ZooDefs.Ids.CREATOR_ALL_ACL);
ret.add(getSuperUserAcl(conf));
return ret;
}
代码示例来源:origin: apache/storm
private static List mkTopoAcls(Map topoConf, int perms) {
List aclList = null;
String payload = (String) topoConf.get(Config.STORM_ZOOKEEPER_TOPOLOGY_AUTH_PAYLOAD);
if (Utils.isZkAuthenticationConfiguredTopology(topoConf)) {
aclList = new ArrayList<>();
ACL acl1 = ZooDefs.Ids.CREATOR_ALL_ACL.get(0);
aclList.add(acl1);
try {
ACL acl2 = new ACL(perms, new Id("digest", DigestAuthenticationProvider.generateDigest(payload)));
aclList.add(acl2);
} catch (NoSuchAlgorithmException e) {
//Should only happen on a badly configured system
throw new RuntimeException(e);
}
}
return aclList;
}
代码示例来源:origin: apache/storm
@Test
public void isZkAuthenticationConfiguredTopologyTest() {
Assert.assertFalse(
"Returns null if given null config",
Utils.isZkAuthenticationConfiguredTopology(null));
Assert.assertFalse(
"Returns false if scheme key is missing",
Utils.isZkAuthenticationConfiguredTopology(emptyMockMap()));
Assert.assertFalse(
"Returns false if scheme value is null",
Utils.isZkAuthenticationConfiguredTopology(topologyMockMap(null)));
Assert.assertTrue(
"Returns true if scheme value is string",
Utils.isZkAuthenticationConfiguredTopology(topologyMockMap("foobar")));
}
代码示例来源:origin: apache/storm
&& !Utils.isZkAuthenticationConfiguredTopology(topoConf)) {
throw new IllegalArgumentException("The cluster is configured for zookeeper authentication, but no payload was provided.");
代码示例来源:origin: org.apache.storm/storm-core
/**
* Get the ZK ACLs that a worker should use when writing to ZK.
* @param conf the config for the topology.
* @return the ACLs
*/
public static List getWorkerACL(Map conf) {
if (!isZkAuthenticationConfiguredTopology(conf)) {
return null;
}
ArrayList ret = new ArrayList(ZooDefs.Ids.CREATOR_ALL_ACL);
ret.add(getSuperUserAcl(conf));
return ret;
}
代码示例来源:origin: org.apache.storm/storm-core
private static List mkTopoAcls(Map topoConf, int perms) {
List aclList = null;
String payload = (String) topoConf.get(Config.STORM_ZOOKEEPER_TOPOLOGY_AUTH_PAYLOAD);
if (Utils.isZkAuthenticationConfiguredTopology(topoConf)) {
aclList = new ArrayList<>();
ACL acl1 = ZooDefs.Ids.CREATOR_ALL_ACL.get(0);
aclList.add(acl1);
try {
ACL acl2 = new ACL(perms, new Id("digest", DigestAuthenticationProvider.generateDigest(payload)));
aclList.add(acl2);
} catch (NoSuchAlgorithmException e) {
//Should only happen on a badly configured system
throw new RuntimeException(e);
}
}
return aclList;
}