Class HadoopCredentialProvider


  • public class HadoopCredentialProvider
    extends Object
    Shim around Hadoop's CredentialProviderFactory provided by hadoop-common.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void createEntry​(org.apache.hadoop.conf.Configuration conf, String name, char[] credential)
      Create a CredentialEntry using the configured Providers.
      static List<String> getKeys​(org.apache.hadoop.conf.Configuration conf)
      Attempt to extract all aliases from any configured CredentialProviders.
      static char[] getValue​(org.apache.hadoop.conf.Configuration conf, String alias)
      Attempt to extract the password from any configured CredentialProviders for the given alias.
      static void setPath​(org.apache.hadoop.conf.Configuration conf, String path)
      Set the Hadoop Credential Provider path in the provided Hadoop Configuration.
    • Constructor Detail

      • HadoopCredentialProvider

        public HadoopCredentialProvider()
    • Method Detail

      • setPath

        public static void setPath​(org.apache.hadoop.conf.Configuration conf,
                                   String path)
        Set the Hadoop Credential Provider path in the provided Hadoop Configuration.
        Parameters:
        conf - the Hadoop Configuration object
        path - the credential provider paths to set
      • getValue

        public static char[] getValue​(org.apache.hadoop.conf.Configuration conf,
                                      String alias)
        Attempt to extract the password from any configured CredentialProviders for the given alias. If no providers or credential is found, null is returned.
        Parameters:
        conf - Configuration for CredentialProvider
        alias - Name of CredentialEntry key
        Returns:
        The credential if found, null otherwise
      • getKeys

        public static List<String> getKeys​(org.apache.hadoop.conf.Configuration conf)
        Attempt to extract all aliases from any configured CredentialProviders.
        Parameters:
        conf - Configuration for the CredentialProvider
        Returns:
        A list of aliases. An empty list if no CredentialProviders are configured, or the providers are empty.
      • createEntry

        public static void createEntry​(org.apache.hadoop.conf.Configuration conf,
                                       String name,
                                       char[] credential)
                                throws IOException
        Create a CredentialEntry using the configured Providers. If multiple CredentialProviders are configured, the first will be used.
        Parameters:
        conf - Configuration for the CredentialProvider
        name - CredentialEntry name (alias)
        credential - The credential
        Throws:
        IOException