List of usage examples for org.apache.hadoop.security.alias JavaKeyStoreProvider SCHEME_NAME
String SCHEME_NAME
To view the source code for org.apache.hadoop.security.alias JavaKeyStoreProvider SCHEME_NAME.
Click Source Link
From source file:org.apache.slider.server.services.security.TestCertificateManager.java
License:Apache License
private void setupCredentials(AggregateConf instanceDefinition, String keyAlias, String trustAlias) throws Exception { Configuration conf = new Configuration(); final Path jksPath = new Path(SecurityUtils.getSecurityDir(), "test.jks"); final String ourUrl = JavaKeyStoreProvider.SCHEME_NAME + "://file" + jksPath.toUri(); File file = new File(SecurityUtils.getSecurityDir(), "test.jks"); file.delete();//from www.j av a2 s . c om conf.set(CredentialProviderFactory.CREDENTIAL_PROVIDER_PATH, ourUrl); instanceDefinition.getAppConf().credentials.put(ourUrl, new ArrayList<String>()); CredentialProvider provider = CredentialProviderFactory.getProviders(conf).get(0); // create new aliases try { if (keyAlias != null) { char[] storepass = { 'k', 'e', 'y', 'p', 'a', 's', 's' }; provider.createCredentialEntry(keyAlias, storepass); } if (trustAlias != null) { char[] trustpass = { 't', 'r', 'u', 's', 't', 'p', 'a', 's', 's' }; provider.createCredentialEntry(trustAlias, trustpass); } // write out so that it can be found in checks provider.flush(); } catch (Exception e) { e.printStackTrace(); throw e; } }