Interface RegistryAuth


  • @Immutable
    public interface RegistryAuth
    Represents all the auth info for a particular registry.

    These are sent to docker during authenticated registry operations in the X-Registry-Config header (see RegistryConfigs).

    Typically these objects are built by requesting auth information from a DockerCredentialHelper. However, in older less-secure docker versions, these can be written directly into the ~/.docker/config.json file, with the username and password joined with a ":" and base-64 encoded.

    • Method Detail

      • password

        @Redacted
        String password()
      • serverAddress

        String serverAddress()
      • identityToken

        String identityToken()
      • fromDockerConfig

        static RegistryAuth.Builder fromDockerConfig​(String serverAddress)
                                              throws 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:
        IOException - when we can't parse the docker config file
      • forAuth

        static RegistryAuth.Builder forAuth​(String auth)
        Parameters:
        auth - the "auth" field of the docker client config file.
        Returns:
        Construct a Builder based upon the "auth" field of the docker client config file.