ProviderUtils (Apache Hadoop Common 3.5.0 API)
Description: declaration: package: org.apache.hadoop.security, class: ProviderUtils

Package org.apache.hadoop.security

# Class ProviderUtils

java.lang.Object
org.apache.hadoop.security.ProviderUtils

public final class ProviderUtils extends Object
Utility methods for both key and credential provider APIs.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final String`
  `NO_PASSWORD_CONT`
  `static final String`
  `NO_PASSWORD_ERROR`
  `static final String`
  `NO_PASSWORD_INSTRUCTIONS_DOC`
  `static final String`
  `NO_PASSWORD_WARN`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static Configuration`
  `excludeIncompatibleCredentialProviders(Configuration config, Class<? extends FileSystem> fileSystemClass)`
  There are certain integrations of the credential provider API in which a recursive dependency between the provider and the hadoop filesystem abstraction causes a problem.
  `static char[]`
  `locatePassword(String envWithPass, String fileWithPass)`
  The password is either found in the environment or in a file.
  `static URI`
  `nestURIForLocalJavaKeyStoreProvider(URI localFile)`
  Mangle given local java keystore file URI to allow use as a LocalJavaKeyStoreProvider.
  `static String`
  `noPasswordError(String envKey, String fileKey)`
  `static String`
  `noPasswordWarning(String envKey, String fileKey)`
  `static Path`
  `unnestUri(URI nestedUri)`
  Convert a nested URI to decode the underlying path.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### NO_PASSWORD_WARN

    @VisibleForTesting public static final String NO_PASSWORD_WARN
    See Also:
      - Constant Field Values

  - ### NO_PASSWORD_ERROR

    @VisibleForTesting public static final String NO_PASSWORD_ERROR
    See Also:
      - Constant Field Values

  - ### NO_PASSWORD_CONT

    @VisibleForTesting public static final String NO_PASSWORD_CONT
    See Also:
      - Constant Field Values

  - ### NO_PASSWORD_INSTRUCTIONS_DOC

    @VisibleForTesting public static final String NO_PASSWORD_INSTRUCTIONS_DOC
    See Also:
      - Constant Field Values

- ## Method Details

  - ### unnestUri

    public static Path unnestUri(URI nestedUri)
    Convert a nested URI to decode the underlying path. The translation takes the authority and parses it into the underlying scheme and authority. For example, "myscheme://hdfs@nn/my/path" is converted to "hdfs://nn/my/path".
    Parameters:
      `nestedUri` - the URI from the nested URI
    Returns:
      the unnested path

  - ### nestURIForLocalJavaKeyStoreProvider

    public static URI nestURIForLocalJavaKeyStoreProvider(URI localFile) throws URISyntaxException
    Mangle given local java keystore file URI to allow use as a LocalJavaKeyStoreProvider.
    Parameters:
      `localFile` - absolute URI with file scheme and no authority component. i.e. return of File.toURI, e.g. file:///home/larry/creds.jceks
    Returns:
      URI of the form localjceks://file/home/larry/creds.jceks
    Throws:
      `IllegalArgumentException` - if localFile isn't not a file uri or if it has an authority component.
      `URISyntaxException` - if the wrapping process violates RFC 2396

  - ### excludeIncompatibleCredentialProviders

    public static Configuration excludeIncompatibleCredentialProviders(Configuration config, Class<? extends FileSystem> fileSystemClass) throws IOException
    There are certain integrations of the credential provider API in which a recursive dependency between the provider and the hadoop filesystem abstraction causes a problem. These integration points need to leverage this utility method to remove problematic provider types from the existing provider path within the configuration.
    Parameters:
      `config` - the existing configuration with provider path
      `fileSystemClass` - the class which providers must be compatible
    Returns:
      Configuration clone with new provider path
    Throws:
      `IOException` - raised on errors performing I/O.

  - ### locatePassword

    public static char[] locatePassword(String envWithPass, String fileWithPass) throws IOException
    The password is either found in the environment or in a file. This routine implements the logic for locating the password in these locations.
    Parameters:
      `envWithPass` - The name of the environment variable that might contain the password. Must not be null.
      `fileWithPass` - The name of a file that could contain the password. Can be null.
    Returns:
      The password as a char []; null if not found.
    Throws:
      `IOException` - If fileWithPass is non-null and points to a nonexistent file or a file that fails to open and be read properly.

  - ### noPasswordWarning

    public static String noPasswordWarning(String envKey, String fileKey)

  - ### noPasswordError

    public static String noPasswordError(String envKey, String fileKey)