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 Details

    • username

      String username()
    • password

      @Redacted String password()
    • email

      @Redacted String email()
      Returns:
      Unused but must be a well-formed email address (e.g. [email protected]).
    • serverAddress

      String serverAddress()
    • identityToken

      String identityToken()
    • toBuilder

      @Derived @Auxiliary default RegistryAuth.Builder toBuilder()
    • 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
    • create

      static RegistryAuth create(String username, String password, String email, String serveraddress, String identitytoken, String auth)
    • 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.
    • builder

      static RegistryAuth.Builder builder()