• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java FileBasedKeyStoresFactory类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.hadoop.security.ssl.FileBasedKeyStoresFactory的典型用法代码示例。如果您正苦于以下问题:Java FileBasedKeyStoresFactory类的具体用法?Java FileBasedKeyStoresFactory怎么用?Java FileBasedKeyStoresFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



FileBasedKeyStoresFactory类属于org.apache.hadoop.security.ssl包,在下文中一共展示了FileBasedKeyStoresFactory类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: createServerSSLConfig

import org.apache.hadoop.security.ssl.FileBasedKeyStoresFactory; //导入依赖的package包/类
private void createServerSSLConfig(String keyStorePassword,
    String trustStorePassword, Configuration conf) throws IOException {
    
    Configuration sslConf = new Configuration(false);
    
    File sslConfFile = new File(Paths.get(BASEDIR, "ssl-server.xml")
        .toString());
    conf.set(SSLFactory.SSL_SERVER_CONF_KEY, sslConfFile.getAbsolutePath());
    filesToPurge.add(sslConfFile.toString());
    sslConf.set(
        FileBasedKeyStoresFactory.resolvePropertyName(
            SSLFactory.Mode.SERVER,
            FileBasedKeyStoresFactory.SSL_KEYSTORE_PASSWORD_TPL_KEY),
        keyStorePassword);
    sslConf.set(
        FileBasedKeyStoresFactory.resolvePropertyName(
            SSLFactory.Mode.SERVER,
            FileBasedKeyStoresFactory.SSL_TRUSTSTORE_PASSWORD_TPL_KEY),
        trustStorePassword);
    
    try (FileWriter fw = new FileWriter(sslConfFile, false)) {
        sslConf.writeXml(fw);
    }
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:25,代码来源:TestHopsSSLConfiguration.java


示例2: SSLFactory

import org.apache.hadoop.security.ssl.FileBasedKeyStoresFactory; //导入依赖的package包/类
/**
 * Creates an SSLFactory.
 *
 * @param mode SSLFactory mode, client or server.
 * @param conf Hadoop configuration from where the SSLFactory configuration
 *             will be read.
 */
public SSLFactory(Mode mode, Configuration conf) {
  this.conf = conf;
  if (mode == null) {
    throw new IllegalArgumentException("mode cannot be NULL");
  }
  this.mode = mode;
  requireClientCert = conf.getBoolean(SSL_REQUIRE_CLIENT_CERT_KEY,
      DEFAULT_SSL_REQUIRE_CLIENT_CERT);
  Configuration sslConf = readSSLConfiguration(mode);

  Class<? extends KeyStoresFactory> klass
      = conf.getClass(KEYSTORES_FACTORY_CLASS_KEY,
      FileBasedKeyStoresFactory.class, KeyStoresFactory.class);
  keystoresFactory = ReflectionUtils.newInstance(klass, sslConf);

  enabledProtocols = conf.getStrings(SSL_ENABLED_PROTOCOLS, DEFAULT_SSL_ENABLED_PROTOCOLS);
}
 
开发者ID:apache,项目名称:tez,代码行数:25,代码来源:SSLFactory.java


示例3: createSSLConfig

import org.apache.hadoop.security.ssl.FileBasedKeyStoresFactory; //导入依赖的package包/类
/**
 * Creates SSL configuration.
 * 
 * @param mode SSLFactory.Mode mode to configure
 * @param keystore String keystore file
 * @param password String store password, or null to avoid setting store
 *   password
 * @param keyPassword String key password, or null to avoid setting key
 *   password
 * @param trustKS String truststore file
 * @return Configuration for SSL
 */
private static Configuration createSSLConfig(SSLFactory.Mode mode,
    String keystore, String password, String keyPassword, String trustKS) {
  String trustPassword = "trustP";

  Configuration sslConf = new Configuration(false);
  if (keystore != null) {
    sslConf.set(FileBasedKeyStoresFactory.resolvePropertyName(mode,
      FileBasedKeyStoresFactory.SSL_KEYSTORE_LOCATION_TPL_KEY), keystore);
  }
  if (password != null) {
    sslConf.set(FileBasedKeyStoresFactory.resolvePropertyName(mode,
      FileBasedKeyStoresFactory.SSL_KEYSTORE_PASSWORD_TPL_KEY), password);
  }
  if (keyPassword != null) {
    sslConf.set(FileBasedKeyStoresFactory.resolvePropertyName(mode,
      FileBasedKeyStoresFactory.SSL_KEYSTORE_KEYPASSWORD_TPL_KEY),
      keyPassword);
  }
  if (trustKS != null) {
    sslConf.set(FileBasedKeyStoresFactory.resolvePropertyName(mode,
      FileBasedKeyStoresFactory.SSL_TRUSTSTORE_LOCATION_TPL_KEY), trustKS);
  }
  if (trustPassword != null) {
    sslConf.set(FileBasedKeyStoresFactory.resolvePropertyName(mode,
      FileBasedKeyStoresFactory.SSL_TRUSTSTORE_PASSWORD_TPL_KEY),
      trustPassword);
  }
  sslConf.set(FileBasedKeyStoresFactory.resolvePropertyName(mode,
    FileBasedKeyStoresFactory.SSL_TRUSTSTORE_RELOAD_INTERVAL_TPL_KEY), "1000");

  return sslConf;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:45,代码来源:KeyStoreTestUtil.java


示例4: init

import org.apache.hadoop.security.ssl.FileBasedKeyStoresFactory; //导入依赖的package包/类
@PostConstruct
public void init() {
  String confDir = settings.getHadoopConfDir();
  File coreSite = new File(confDir, "core-site.xml");
  if (!coreSite.exists()) {
    handleMissingConf("core-site.xml", confDir);
  }
  
  Configuration conf = new Configuration();
  conf.addResource(new Path(coreSite.getAbsolutePath()));
  
  sslConf = new Configuration(false);
  String hadoopConfDir = settings.getHadoopConfDir();
  File serverSSLConf = new File(hadoopConfDir, conf.get(SSLFactory
      .SSL_SERVER_CONF_KEY, "ssl-server.xml"));
  sslConf.addResource(new Path(serverSSLConf.getAbsolutePath()));
  superKeystorePath = sslConf.get(
      FileBasedKeyStoresFactory.resolvePropertyName(SSLFactory.Mode.SERVER,
          FileBasedKeyStoresFactory.SSL_KEYSTORE_LOCATION_TPL_KEY));
  superKeystorePassword = sslConf.get(
      FileBasedKeyStoresFactory.resolvePropertyName(SSLFactory.Mode.SERVER,
          FileBasedKeyStoresFactory.SSL_KEYSTORE_PASSWORD_TPL_KEY));
  superTrustStorePath = sslConf.get(
      FileBasedKeyStoresFactory.resolvePropertyName(SSLFactory.Mode.SERVER,
          FileBasedKeyStoresFactory.SSL_TRUSTSTORE_LOCATION_TPL_KEY));
  superTrustStorePassword = sslConf.get(
      FileBasedKeyStoresFactory.resolvePropertyName(SSLFactory.Mode.SERVER,
          FileBasedKeyStoresFactory.SSL_TRUSTSTORE_PASSWORD_TPL_KEY));
  try {
    superuser = UserGroupInformation.getLoginUser().getUserName();
  } catch (IOException ex) {
    throw new IllegalStateException("Could not identify login user");
  }
}
 
开发者ID:hopshadoop,项目名称:hopsworks,代码行数:35,代码来源:BaseHadoopClientsService.java


示例5: parseSuperuserPasswords

import org.apache.hadoop.security.ssl.FileBasedKeyStoresFactory; //导入依赖的package包/类
private void parseSuperuserPasswords(Configuration conf) {
  Configuration sslConf = new Configuration(false);
  sslConf.addResource(conf.get(SSLFactory.SSL_SERVER_CONF_KEY,
      "ssl-server.xml"));
  superKeystorePass = sslConf.get(
      FileBasedKeyStoresFactory.resolvePropertyName(SSLFactory.Mode.SERVER,
          FileBasedKeyStoresFactory.SSL_KEYSTORE_PASSWORD_TPL_KEY));
  superTruststorePass = sslConf.get(
      FileBasedKeyStoresFactory.resolvePropertyName(SSLFactory.Mode.SERVER,
          FileBasedKeyStoresFactory.SSL_TRUSTSTORE_PASSWORD_TPL_KEY));
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:12,代码来源:CertificateLocalizationService.java


示例6: createSSLConfig

import org.apache.hadoop.security.ssl.FileBasedKeyStoresFactory; //导入依赖的package包/类
/**
 * Creates SSL configuration.
 *
 * @param mode SSLFactory.Mode mode to configure
 * @param keystore String keystore file
 * @param password String store password, or null to avoid setting store
 *   password
 * @param keyPassword String key password, or null to avoid setting key
 *   password
 * @param trustKS String truststore file
 * @return Configuration for SSL
 */
private static Configuration createSSLConfig(SSLFactory.Mode mode,
    String keystore, String password, String keyPassword, String trustKS) {
  String trustPassword = "trustP";

  Configuration sslConf = new Configuration(false);
  if (keystore != null) {
    sslConf.set(FileBasedKeyStoresFactory.resolvePropertyName(mode,
      FileBasedKeyStoresFactory.SSL_KEYSTORE_LOCATION_TPL_KEY), keystore);
  }
  if (password != null) {
    sslConf.set(FileBasedKeyStoresFactory.resolvePropertyName(mode,
      FileBasedKeyStoresFactory.SSL_KEYSTORE_PASSWORD_TPL_KEY), password);
  }
  if (keyPassword != null) {
    sslConf.set(FileBasedKeyStoresFactory.resolvePropertyName(mode,
      FileBasedKeyStoresFactory.SSL_KEYSTORE_KEYPASSWORD_TPL_KEY),
      keyPassword);
  }
  if (trustKS != null) {
    sslConf.set(FileBasedKeyStoresFactory.resolvePropertyName(mode,
      FileBasedKeyStoresFactory.SSL_TRUSTSTORE_LOCATION_TPL_KEY), trustKS);
  }
  if (trustPassword != null) {
    sslConf.set(FileBasedKeyStoresFactory.resolvePropertyName(mode,
      FileBasedKeyStoresFactory.SSL_TRUSTSTORE_PASSWORD_TPL_KEY),
      trustPassword);
  }
  sslConf.set(FileBasedKeyStoresFactory.resolvePropertyName(mode,
    FileBasedKeyStoresFactory.SSL_TRUSTSTORE_RELOAD_INTERVAL_TPL_KEY), "1000");

  return sslConf;
}
 
开发者ID:apache,项目名称:hbase,代码行数:45,代码来源:KeyStoreTestUtil.java



注:本文中的org.apache.hadoop.security.ssl.FileBasedKeyStoresFactory类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java LocatableBlock类代码示例发布时间:2022-05-22
下一篇:
Java SNMP4JSettings类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap