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

x33g5p2x  于2022-02-01 转载在 其他  
字(4.9k)|赞(0)|评价(0)|浏览(125)

本文整理了Java中org.apache.storm.utils.Utils.isZkAuthenticationConfiguredStormServer()方法的一些代码示例,展示了Utils.isZkAuthenticationConfiguredStormServer()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utils.isZkAuthenticationConfiguredStormServer()方法的具体详情如下:
包路径:org.apache.storm.utils.Utils
类名称:Utils
方法名:isZkAuthenticationConfiguredStormServer

Utils.isZkAuthenticationConfiguredStormServer介绍

[英]Is the cluster configured to interact with ZooKeeper in a secure way? This only works when called from within Nimbus or a Supervisor process.
[中]集群是否配置为以安全的方式与ZooKeeper交互?这仅在从Nimbus或主管流程中调用时有效。

代码示例

代码示例来源:origin: apache/storm

public static List<ACL> getNimbusAcls(Map<String, Object> conf) {
  List<ACL> acls = null;
  if (Utils.isZkAuthenticationConfiguredStormServer(conf)) {
    acls = ZK_ACLS;
  }
  return acls;
}

代码示例来源:origin: apache/storm

private static List<ACL> getDefaultNimbusSupervisorZkAcls(Map<String, Object> conf) {
  if (Utils.isZkAuthenticationConfiguredStormServer(conf)) {
    return NIMBUS_SUPERVISOR_ZK_ACLS;
  }
  return null;
}

代码示例来源:origin: apache/storm

private static boolean willWorkerTokensBeStoredSecurely(Map<String, Object> conf) {
  boolean overrideZkAuth = ObjectReader.getBoolean(conf.get("TESTING.ONLY.ENABLE.INSECURE.WORKER.TOKENS"), false);
  if (Utils.isZkAuthenticationConfiguredStormServer(conf)) {
    return true;
  } else if (overrideZkAuth) {
    LOG.error("\n\n\t\tYOU HAVE ENABLED INSECURE WORKER TOKENS.  IF THIS IS NOT A UNIT TEST PLEASE STOP NOW!!!\n\n");
    return true;
  }
  return false;
}

代码示例来源:origin: apache/storm

@Override
  public List<ACL> getZkSecretAcls(WorkerTokenServiceType type, Map<String, Object> conf) {
    if (!Utils.isZkAuthenticationConfiguredStormServer(conf)) {
      //This is here only for testing.
      LOG.error("Will Store Worker Token Keys in ZK without ACLs.  If you are not running tests STOP NOW!");
      return null;
    }
    switch (type) {
      case NIMBUS:
        //Fall through on purpose
      case SUPERVISOR:
        return ZooDefs.Ids.CREATOR_ALL_ACL;
      case DRPC:
        List<ACL> ret = new ArrayList<>(ZooDefs.Ids.CREATOR_ALL_ACL);
        String drpcAcl = (String) conf.get(Config.STORM_ZOOKEEPER_DRPC_ACL);
        if (drpcAcl != null) {
          ret.add(new ACL(ZooDefs.Perms.READ,
                  Utils.parseZkId(drpcAcl, Config.STORM_ZOOKEEPER_DRPC_ACL)));
        } //else we assume it is the same as teh SUPER_ACL which is covered by CREATOR_ALL
        return ret;
      default:
        throw new IllegalStateException("WorkerTokens for " + type + " are not currently supported.");
    }
  }
},

代码示例来源:origin: apache/storm

@Test
public void isZkAuthenticationConfiguredStormServerWithPropertyTest() {
  String key = "java.security.auth.login.config";
  String oldValue = System.getProperty(key);
  try {
    System.setProperty("java.security.auth.login.config", "anything");
    Assert.assertTrue(Utils.isZkAuthenticationConfiguredStormServer(emptyMockMap()));
  } finally {
    // reset property
    if (oldValue == null) {
      System.clearProperty(key);
    } else {
      System.setProperty(key, oldValue);
    }
  }
}

代码示例来源:origin: apache/storm

@Test
public void isZkAuthenticationConfiguredStormServerTest() {
  Assert.assertFalse(
    "Returns false if given null config",
    Utils.isZkAuthenticationConfiguredStormServer(null));
  Assert.assertFalse(
    "Returns false if scheme key is missing",
    Utils.isZkAuthenticationConfiguredStormServer(emptyMockMap()));
  Assert.assertFalse(
    "Returns false if scheme value is null",
    Utils.isZkAuthenticationConfiguredStormServer(serverMockMap(null)));
  Assert.assertTrue(
    "Returns true if scheme value is string",
    Utils.isZkAuthenticationConfiguredStormServer(serverMockMap("foobar")));
}

代码示例来源:origin: apache/storm

if (!Utils.isZkAuthenticationConfiguredStormServer(conf)) {
  topoConf.remove(Config.STORM_ZOOKEEPER_TOPOLOGY_AUTH_SCHEME);
  topoConf.remove(Config.STORM_ZOOKEEPER_TOPOLOGY_AUTH_PAYLOAD);
if (Utils.isZkAuthenticationConfiguredStormServer(conf)
  && !Utils.isZkAuthenticationConfiguredTopology(topoConf)) {
  throw new IllegalArgumentException("The cluster is configured for zookeeper authentication, but no payload was provided.");

代码示例来源:origin: apache/storm

if (!Utils.isZkAuthenticationConfiguredStormServer(conf)) {
  LOG.info("SECURITY IS DISABLED NO FURTHER CHECKS...");

代码示例来源:origin: org.apache.storm/storm-core

@Override
public void prepare(Map conf, String overrideBase, NimbusInfo nimbusInfo) {
  this.conf = conf;
  this.nimbusInfo = nimbusInfo;
  List<ACL> acl = null;
  if (Utils.isZkAuthenticationConfiguredStormServer(conf)) {
    acl = ZooDefs.Ids.CREATOR_ALL_ACL;
  }
  zkClient = BlobStoreUtils.createZKClient(conf, acl);
  if (overrideBase == null) {
    overrideBase = ConfigUtils.absoluteStormBlobStoreDir(conf);
  }
  File baseDir = new File(overrideBase, BASE_BLOBS_DIR_NAME);
  try {
    fbs = new FileBlobStoreImpl(baseDir, conf);
  } catch (IOException e) {
    throw new RuntimeException(e);
  }
  _aclHandler = new BlobStoreAclHandler(conf);
}

代码示例来源:origin: org.apache.storm/storm-core

if (!Utils.isZkAuthenticationConfiguredStormServer(conf)) {
  LOG.info("SECURITY IS DISABLED NO FURTHER CHECKS...");

代码示例来源:origin: org.apache.storm/storm-core

if (Utils.isZkAuthenticationConfiguredStormServer(conf)) {
  acls = SupervisorUtils.supervisorZkAcls();

相关文章

Utils类方法