本文整理汇总了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;未经允许,请勿转载。 |
请发表评论