gpt4 book ai didi

org.apache.hadoop.security.authentication.util.ZKSignerSecretProvider类的使用及代码示例

转载 作者:知者 更新时间:2024-03-16 05:41:31 26 4
gpt4 key购买 nike

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

ZKSignerSecretProvider介绍

[英]A SignerSecretProvider that synchronizes a rolling random secret between multiple servers using ZooKeeper.

It works by storing the secrets and next rollover time in a ZooKeeper znode. All ZKSignerSecretProviders looking at that znode will use those secrets and next rollover time to ensure they are synchronized. There is no "leader" -- any of the ZKSignerSecretProviders can choose the next secret; which one is indeterminate. Kerberos-based ACLs can also be enforced to prevent a malicious third-party from getting or setting the secrets. It uses its own CuratorFramework client for talking to ZooKeeper. If you want to use your own Curator client, you can pass it to ZKSignerSecretProvider; see org.apache.hadoop.security.authentication.server.AuthenticationFilterfor more details.

Details of the configurations are listed on Configuration Page
[中]SignerSecretProvider,使用ZooKeeper在多个服务器之间同步滚动随机密钥。
它的工作原理是将秘密和下一次翻滚时间存储在ZooKeeper znode中。所有ZKSignerSecretProviders都将使用这些秘密和下一个滚动时间来确保它们是同步的。没有“领导者”——任何ZKSignerSecretProvider都可以选择下一个秘密;哪一个是不确定的。还可以强制执行基于Kerberos的ACL,以防止恶意第三方获取或设置机密。它使用自己的CuratorFramework客户端与ZooKeeper对话。如果你想使用自己的策展人客户端,你可以将其传递给ZKSignersSecretProvider;见org。阿帕奇。hadoop。安全认证。服务器有关详细信息,请参阅AuthenticationFilter。
配置的详细信息列在Configuration Page

代码示例

代码示例来源:origin: org.apache.hadoop/hadoop-auth

client = (CuratorFramework) curatorClientObj;
} else {
 client = createCuratorClient(config);
 servletContext.setAttribute(
   ZOOKEEPER_SIGNER_SECRET_PROVIDER_CURATOR_CLIENT_ATTRIBUTE, client);
     .forPath(path, generateZKData(generateRandomSecret(),
     generateRandomSecret(), null));
 zkVersion = 0;
 LOG.info("Creating secret znode");
pullFromZK(true);
long initialDelay = nextRolloverDate - System.currentTimeMillis();

代码示例来源:origin: io.prestosql.hadoop/hadoop-apache

@Override
protected synchronized void rollSecret() {
 super.rollSecret();
 // Try to push the information to ZooKeeper with a potential next secret.
 nextRolloverDate += tokenValidity;
 byte[][] secrets = super.getAllSecrets();
 pushToZK(generateRandomSecret(), secrets[0], secrets[1]);
 // Pull info from ZooKeeper to get the decided next secret
 // passing false tells it that we don't care about most of the data
 pullFromZK(false);
}

代码示例来源:origin: com.github.jiayuhan-it/hadoop-auth

/**
 * Pushes proposed data to ZooKeeper.  If a different server pushes its data
 * first, it gives up.
 * @param newSecret The new secret to use
 * @param currentSecret The current secret
 * @param previousSecret  The previous secret
 */
private synchronized void pushToZK(byte[] newSecret, byte[] currentSecret,
    byte[] previousSecret) {
 byte[] bytes = generateZKData(newSecret, currentSecret, previousSecret);
 try {
  client.setData().withVersion(zkVersion).forPath(path, bytes);
 } catch (KeeperException.BadVersionException bve) {
  LOG.debug("Unable to push to znode; another server already did it");
 } catch (Exception ex) {
  LOG.error("An unexpected exception occured pushing data to ZooKeeper",
      ex);
 }
}

代码示例来源:origin: org.apache.hadoop/hadoop-auth

LOG.info("Connecting to ZooKeeper with SASL/Kerberos"
    + "and using 'sasl' ACLs");
String principal = setJaasConfiguration(config);
System.setProperty(ZooKeeperSaslClient.LOGIN_CONTEXT_NAME_KEY,
    JAAS_LOGIN_ENTRY_NAME);

代码示例来源:origin: org.apache.hadoop/hadoop-auth

provider.init(config, ctx, validity);
} else if ("zookeeper".equals(name)) {
 provider = new ZKSignerSecretProvider();
 provider.init(config, ctx, validity);
} else {

代码示例来源:origin: org.apache.hadoop/hadoop-auth

/**
 * Pushes proposed data to ZooKeeper.  If a different server pushes its data
 * first, it gives up.
 * @param newSecret The new secret to use
 * @param currentSecret The current secret
 * @param previousSecret  The previous secret
 */
private synchronized void pushToZK(byte[] newSecret, byte[] currentSecret,
    byte[] previousSecret) {
 byte[] bytes = generateZKData(newSecret, currentSecret, previousSecret);
 try {
  client.setData().withVersion(zkVersion).forPath(path, bytes);
 } catch (KeeperException.BadVersionException bve) {
  LOG.debug("Unable to push to znode; another server already did it");
 } catch (Exception ex) {
  LOG.error("An unexpected exception occurred pushing data to ZooKeeper",
      ex);
 }
}

代码示例来源:origin: io.hops/hadoop-auth

LOG.info("Connecting to ZooKeeper with SASL/Kerberos"
    + "and using 'sasl' ACLs");
String principal = setJaasConfiguration(config);
System.setProperty(ZooKeeperSaslClient.LOGIN_CONTEXT_NAME_KEY,
    JAAS_LOGIN_ENTRY_NAME);

代码示例来源:origin: io.hops/hadoop-auth

provider.init(config, ctx, validity);
} else if ("zookeeper".equals(name)) {
 provider = new ZKSignerSecretProvider();
 provider.init(config, ctx, validity);
} else {

代码示例来源:origin: com.github.jiayuhan-it/hadoop-auth

client = (CuratorFramework) curatorClientObj;
} else {
 client = createCuratorClient(config);
 servletContext.setAttribute(
   ZOOKEEPER_SIGNER_SECRET_PROVIDER_CURATOR_CLIENT_ATTRIBUTE, client);
     .forPath(path, generateZKData(generateRandomSecret(),
     generateRandomSecret(), null));
 zkVersion = 0;
 LOG.info("Creating secret znode");
pullFromZK(true);
long initialDelay = nextRolloverDate - System.currentTimeMillis();

代码示例来源:origin: org.apache.hadoop/hadoop-auth

@Override
protected synchronized void rollSecret() {
 super.rollSecret();
 // Try to push the information to ZooKeeper with a potential next secret.
 nextRolloverDate += tokenValidity;
 byte[][] secrets = super.getAllSecrets();
 pushToZK(generateRandomSecret(), secrets[0], secrets[1]);
 // Pull info from ZooKeeper to get the decided next secret
 // passing false tells it that we don't care about most of the data
 pullFromZK(false);
}

代码示例来源:origin: io.hops/hadoop-auth

/**
 * Pushes proposed data to ZooKeeper.  If a different server pushes its data
 * first, it gives up.
 * @param newSecret The new secret to use
 * @param currentSecret The current secret
 * @param previousSecret  The previous secret
 */
private synchronized void pushToZK(byte[] newSecret, byte[] currentSecret,
    byte[] previousSecret) {
 byte[] bytes = generateZKData(newSecret, currentSecret, previousSecret);
 try {
  client.setData().withVersion(zkVersion).forPath(path, bytes);
 } catch (KeeperException.BadVersionException bve) {
  LOG.debug("Unable to push to znode; another server already did it");
 } catch (Exception ex) {
  LOG.error("An unexpected exception occurred pushing data to ZooKeeper",
      ex);
 }
}

代码示例来源:origin: com.github.jiayuhan-it/hadoop-auth

LOG.info("Connecting to ZooKeeper with SASL/Kerberos"
    + "and using 'sasl' ACLs");
String principal = setJaasConfiguration(config);
System.setProperty(ZooKeeperSaslClient.LOGIN_CONTEXT_NAME_KEY,
    JAAS_LOGIN_ENTRY_NAME);

代码示例来源:origin: com.github.jiayuhan-it/hadoop-auth

provider.init(config, ctx, validity);
} else if ("zookeeper".equals(name)) {
 provider = new ZKSignerSecretProvider();
 provider.init(config, ctx, validity);
} else {

代码示例来源:origin: io.hops/hadoop-auth

client = (CuratorFramework) curatorClientObj;
} else {
 client = createCuratorClient(config);
 servletContext.setAttribute(
   ZOOKEEPER_SIGNER_SECRET_PROVIDER_CURATOR_CLIENT_ATTRIBUTE, client);
     .forPath(path, generateZKData(generateRandomSecret(),
     generateRandomSecret(), null));
 zkVersion = 0;
 LOG.info("Creating secret znode");
pullFromZK(true);
long initialDelay = nextRolloverDate - System.currentTimeMillis();

代码示例来源:origin: io.hops/hadoop-auth

@Override
protected synchronized void rollSecret() {
 super.rollSecret();
 // Try to push the information to ZooKeeper with a potential next secret.
 nextRolloverDate += tokenValidity;
 byte[][] secrets = super.getAllSecrets();
 pushToZK(generateRandomSecret(), secrets[0], secrets[1]);
 // Pull info from ZooKeeper to get the decided next secret
 // passing false tells it that we don't care about most of the data
 pullFromZK(false);
}

代码示例来源:origin: hopshadoop/hops

/**
 * Pushes proposed data to ZooKeeper.  If a different server pushes its data
 * first, it gives up.
 * @param newSecret The new secret to use
 * @param currentSecret The current secret
 * @param previousSecret  The previous secret
 */
private synchronized void pushToZK(byte[] newSecret, byte[] currentSecret,
    byte[] previousSecret) {
 byte[] bytes = generateZKData(newSecret, currentSecret, previousSecret);
 try {
  client.setData().withVersion(zkVersion).forPath(path, bytes);
 } catch (KeeperException.BadVersionException bve) {
  LOG.debug("Unable to push to znode; another server already did it");
 } catch (Exception ex) {
  LOG.error("An unexpected exception occurred pushing data to ZooKeeper",
      ex);
 }
}

代码示例来源:origin: hopshadoop/hops

LOG.info("Connecting to ZooKeeper with SASL/Kerberos"
    + "and using 'sasl' ACLs");
String principal = setJaasConfiguration(config);
System.setProperty(ZooKeeperSaslClient.LOGIN_CONTEXT_NAME_KEY,
    JAAS_LOGIN_ENTRY_NAME);

代码示例来源:origin: hopshadoop/hops

provider.init(config, ctx, validity);
} else if ("zookeeper".equals(name)) {
 provider = new ZKSignerSecretProvider();
 provider.init(config, ctx, validity);
} else {

代码示例来源:origin: hopshadoop/hops

client = (CuratorFramework) curatorClientObj;
} else {
 client = createCuratorClient(config);
 servletContext.setAttribute(
   ZOOKEEPER_SIGNER_SECRET_PROVIDER_CURATOR_CLIENT_ATTRIBUTE, client);
     .forPath(path, generateZKData(generateRandomSecret(),
     generateRandomSecret(), null));
 zkVersion = 0;
 LOG.info("Creating secret znode");
pullFromZK(true);
long initialDelay = nextRolloverDate - System.currentTimeMillis();

代码示例来源:origin: com.github.jiayuhan-it/hadoop-auth

@Override
protected synchronized void rollSecret() {
 super.rollSecret();
 // Try to push the information to ZooKeeper with a potential next secret.
 nextRolloverDate += tokenValidity;
 byte[][] secrets = super.getAllSecrets();
 pushToZK(generateRandomSecret(), secrets[0], secrets[1]);
 // Pull info from ZooKeeper to get the decided next secret
 // passing false tells it that we don't care about most of the data
 pullFromZK(false);
}

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com