热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

org.apache.storm.utils.Utils.isZkAuthenticationConfiguredTopology()方法的使用及代码示例

本文整理了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

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;
}

推荐阅读
author-avatar
mobiledu2502868917
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有