public class CredentialProviderFactoryShim extends Object
The CredentialProvider classes only exist in 2.6.0, so, to use them, we have to do a bunch of reflection. This will also help us to continue to support [2.2.0,2.6.0) when 2.6.0 is officially released.
Modifier and Type | Field and Description |
---|---|
static String |
CREDENTIAL_PROVIDER_PATH |
static String |
HADOOP_CRED_ENTRY_CLASS_NAME |
static String |
HADOOP_CRED_ENTRY_GET_CREDENTIAL_METHOD_NAME |
static String |
HADOOP_CRED_PROVIDER_CLASS_NAME |
static String |
HADOOP_CRED_PROVIDER_CREATE_CREDENTIAL_ENTRY_METHOD_NAME |
static String |
HADOOP_CRED_PROVIDER_FACTORY_CLASS_NAME |
static String |
HADOOP_CRED_PROVIDER_FACTORY_GET_PROVIDERS_METHOD_NAME |
static String |
HADOOP_CRED_PROVIDER_FLUSH_METHOD_NAME |
static String |
HADOOP_CRED_PROVIDER_GET_ALIASES_METHOD_NAME |
static String |
HADOOP_CRED_PROVIDER_GET_CREDENTIAL_ENTRY_METHOD_NAME |
Constructor and Description |
---|
CredentialProviderFactoryShim() |
Modifier and Type | Method and Description |
---|---|
static void |
createEntry(org.apache.hadoop.conf.Configuration conf,
String name,
char[] credential)
Create a CredentialEntry using the configured Providers.
|
static void |
createEntryInProvider(Object credentialProvider,
String name,
char[] credential)
Create a CredentialEntry with the give name and credential in the credentialProvider.
|
protected static List<String> |
getAliasesFromHadoopCredentialProvider(org.apache.hadoop.conf.Configuration conf) |
static org.apache.hadoop.conf.Configuration |
getConfiguration(org.apache.hadoop.conf.Configuration conf,
String credentialProviders)
Adds the Credential Provider configuration elements to the provided
Configuration . |
static org.apache.hadoop.conf.Configuration |
getConfiguration(String credentialProviders)
Create a Hadoop
Configuration with the appropriate members to access
CredentialProviders |
protected static List<Object> |
getCredentialProviders(org.apache.hadoop.conf.Configuration conf)
Wrapper to fetch the configured
List<CredentialProvider> s. |
protected static char[] |
getFromHadoopCredentialProvider(org.apache.hadoop.conf.Configuration conf,
String alias) |
static List<String> |
getKeys(org.apache.hadoop.conf.Configuration conf)
Attempt to extract all aliases from any configured CredentialsProviders.
|
static char[] |
getValueFromCredentialProvider(org.apache.hadoop.conf.Configuration conf,
String alias)
Attempt to extract the password from any configured CredentialsProviders for the given alias.
|
static boolean |
isHadoopCredentialProviderAvailable()
Determine if we can load the necessary CredentialProvider classes.
|
public static final String HADOOP_CRED_PROVIDER_FACTORY_CLASS_NAME
public static final String HADOOP_CRED_PROVIDER_FACTORY_GET_PROVIDERS_METHOD_NAME
public static final String HADOOP_CRED_PROVIDER_CLASS_NAME
public static final String HADOOP_CRED_PROVIDER_GET_CREDENTIAL_ENTRY_METHOD_NAME
public static final String HADOOP_CRED_PROVIDER_GET_ALIASES_METHOD_NAME
public static final String HADOOP_CRED_PROVIDER_CREATE_CREDENTIAL_ENTRY_METHOD_NAME
public static final String HADOOP_CRED_PROVIDER_FLUSH_METHOD_NAME
public static final String HADOOP_CRED_ENTRY_CLASS_NAME
public static final String HADOOP_CRED_ENTRY_GET_CREDENTIAL_METHOD_NAME
public static final String CREDENTIAL_PROVIDER_PATH
public static boolean isHadoopCredentialProviderAvailable()
protected static List<Object> getCredentialProviders(org.apache.hadoop.conf.Configuration conf)
List<CredentialProvider>
s.conf
- Configuration with Property#GENERAL_SECURITY_CREDENTIAL_PROVIDER_PATHS definedprotected static char[] getFromHadoopCredentialProvider(org.apache.hadoop.conf.Configuration conf, String alias)
protected static List<String> getAliasesFromHadoopCredentialProvider(org.apache.hadoop.conf.Configuration conf)
public static org.apache.hadoop.conf.Configuration getConfiguration(String credentialProviders)
Configuration
with the appropriate members to access
CredentialProviderscredentialProviders
- Comma-separated list of CredentialProvider URLspublic static org.apache.hadoop.conf.Configuration getConfiguration(org.apache.hadoop.conf.Configuration conf, String credentialProviders)
Configuration
.conf
- Existing Hadoop ConfigurationcredentialProviders
- Comma-separated list of CredentialProvider URLspublic static char[] getValueFromCredentialProvider(org.apache.hadoop.conf.Configuration conf, String alias) throws IOException
conf
- Configuration for CredentialProvideralias
- Name of CredentialEntry keyIOException
- On errors reading a CredentialProviderpublic static List<String> getKeys(org.apache.hadoop.conf.Configuration conf) throws IOException
conf
- Configuration for the CredentialProviderIOException
- On errors reading a CredentialProviderpublic static void createEntry(org.apache.hadoop.conf.Configuration conf, String name, char[] credential) throws IOException
conf
- Configuration for the CredentialProvidername
- CredentialEntry name (alias)credential
- The credentialIOException
public static void createEntryInProvider(Object credentialProvider, String name, char[] credential) throws IOException
credentialProvider
- Instance of CredentialProvidername
- CredentialEntry name (alias)credential
- The credential to storeIOException
Copyright © 2011–2018 The Apache Software Foundation. All rights reserved.