Class RegistryAuth

    • Constructor Detail

      • RegistryAuth

        public RegistryAuth()
    • Method Detail

      • username

        @Nullable
        public abstract java.lang.String username()
      • password

        @Nullable
        public abstract java.lang.String password()
      • email

        @Nullable
        public abstract java.lang.String email()
        Unused but must be a well-formed email address (e.g. 1234@5678.com).
      • serverAddress

        @Nullable
        public abstract java.lang.String serverAddress()
      • identityToken

        @Nullable
        public abstract java.lang.String identityToken()
      • toString

        public final java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • fromDockerConfig

        @Deprecated
        public static RegistryAuth.Builder fromDockerConfig()
                                                     throws java.io.IOException
        Deprecated.
        in favor of registryAuthSupplier
        This function looks for and parses credentials for logging into Docker registries. We first look in ~/.docker/config.json and fallback to ~/.dockercfg. We use the first credential in the config file. These files are created from running `docker login`.
        Returns:
        a RegistryAuth.Builder
        Throws:
        java.io.IOException - when we can't parse the docker config file
      • fromDockerConfig

        public static RegistryAuth.Builder fromDockerConfig​(java.lang.String serverAddress)
                                                     throws java.io.IOException
        This function looks for and parses credentials for logging into the Docker registry specified by serverAddress. We first look in ~/.docker/config.json and fallback to ~/.dockercfg. These files are created from running `docker login`.
        Parameters:
        serverAddress - A string representing the server address
        Returns:
        a RegistryAuth.Builder
        Throws:
        java.io.IOException - when we can't parse the docker config file
      • fromDockerConfig

        static RegistryAuth.Builder fromDockerConfig​(java.nio.file.Path configPath)
                                              throws java.io.IOException
        Returns the first credential from the specified path to the docker file. This method is package-local so we can test it.
        Parameters:
        configPath - The path to the config file
        Returns:
        a RegistryAuth.Builder
        Throws:
        java.io.IOException - when we can't parse the docker config file
      • fromDockerConfig

        static RegistryAuth.Builder fromDockerConfig​(java.nio.file.Path configPath,
                                                     java.lang.String serverAddress)
                                              throws java.io.IOException
        Returns the specified credential from the specified path to the docker file. This method is package-local so we can test it.
        Parameters:
        configPath - The path to the config file
        serverAddress - A string representing the server address
        Returns:
        a RegistryAuth.Builder
        Throws:
        java.io.IOException - If an IOException occurred
      • create

        public static RegistryAuth create​(java.lang.String username,
                                          java.lang.String password,
                                          java.lang.String email,
                                          java.lang.String serveraddress,
                                          java.lang.String identitytoken,
                                          java.lang.String auth)
      • forAuth

        public static RegistryAuth.Builder forAuth​(java.lang.String auth)
        Construct a Builder based upon the "auth" field of the docker client config file.