Class S3xLoginHelper

java.lang.Object
org.apache.hadoop.fs.s3native.S3xLoginHelper

@Private @Evolving public final class S3xLoginHelper extends Object
Class to aid logging in to S3 endpoints. It is in S3N so that it can be used across all S3 filesystems. The core function of this class was the extraction and decoding of user:secret information from filesystems URIs. All that is left now is some URI canonicalization and checking.
  • Method Details

    • buildFSURI

      public static URI buildFSURI(URI uri)
      Build the filesystem URI.
      Parameters:
      uri - filesystem uri
      Returns:
      the URI to use as the basis for FS operation and qualifying paths.
      Throws:
      NullPointerException - if the URI has null parts.
    • canonicalizeUri

      public static URI canonicalizeUri(URI uri, int defaultPort)
      Canonicalize the given URI.
      Parameters:
      uri - the URI to canonicalize
      defaultPort - default port to use in canonicalized URI if the input URI has no port and this value is greater than 0
      Returns:
      a new, canonicalized URI.
    • checkPath

      public static void checkPath(org.apache.hadoop.conf.Configuration conf, URI fsUri, org.apache.hadoop.fs.Path path, int defaultPort)
      Check the path, ignoring authentication details. See FileSystem.checkPath(Path) for the operation of this. Essentially
      1. The URI is canonicalized.
      2. If the schemas match, the hosts are compared.
      3. If there is a mismatch between null/non-null host, the default FS values are used to patch in the host.
      That all originates in the core FS; the sole change here being to use URI.getHost() over URI.getAuthority(). Some of that code looks a relic of the code anti-pattern of using "hdfs:file.txt" to define the path without declaring the hostname. It's retained for compatibility.
      Parameters:
      conf - FS configuration
      fsUri - the FS URI
      path - path to check
      defaultPort - default port of FS