Class RegistryAuthLocator
- java.lang.Object
-
- com.bmuschko.gradle.docker.internal.RegistryAuthLocator
-
public class RegistryAuthLocator extends Object
Utility class to get credentials information from extension of typeDockerRegistryCredentials
or from$DOCKER_CONFIG/.docker/config.json
file.Supports auth token, credentials store and credentials helpers. Only Linux OS is supported at the moment. Returns default auth object if called on Windows.
The class is ported from the testcontainers-java project (PR 729).
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
RegistryAuthLocator.Factory
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getRegistry(String image)
Extract registry name from the image namecom.github.dockerjava.api.model.AuthConfigurations
lookupAllAuthConfigs()
Gets all authorization information using $DOCKER_CONFIG/.docker/config.json file If missing, an empty AuthConfigurations object is returnedcom.github.dockerjava.api.model.AuthConfigurations
lookupAllAuthConfigs(DockerRegistryCredentials registryCredentials)
Gets all authorization information using $DOCKER_CONFIG/.docker/config.json file If missing, an AuthConfigurations object containing only the passed registryCredentials is returnedcom.github.dockerjava.api.model.AuthConfigurations
lookupAllAuthConfigs(com.github.dockerjava.api.model.AuthConfig additionalAuthConfig)
Gets all authorization information using $DOCKER_CONFIG/.docker/config.json file If missing, an AuthConfigurations object containing only the passed additionalAuthConfig is returnedcom.github.dockerjava.api.model.AuthConfig
lookupAuthConfig(String image, DockerRegistryCredentials registryCredentials)
Gets authorization information using $DOCKER_CONFIG/.docker/config.json file If missing, gets the information from the registryCredentials object
-
-
-
Method Detail
-
lookupAuthConfig
public com.github.dockerjava.api.model.AuthConfig lookupAuthConfig(String image, DockerRegistryCredentials registryCredentials)
Gets authorization information using $DOCKER_CONFIG/.docker/config.json file If missing, gets the information from the registryCredentials object- Parameters:
registryCredentials
- extension of type registryCredentialsimage
- the name of docker image the action to be authorized for- Returns:
- AuthConfig object with a credentials info or default object if no credentials found
-
lookupAllAuthConfigs
public com.github.dockerjava.api.model.AuthConfigurations lookupAllAuthConfigs()
Gets all authorization information using $DOCKER_CONFIG/.docker/config.json file If missing, an empty AuthConfigurations object is returned- Returns:
- AuthConfigurations object containing all authorization information, or an empty object if not available
-
lookupAllAuthConfigs
public com.github.dockerjava.api.model.AuthConfigurations lookupAllAuthConfigs(DockerRegistryCredentials registryCredentials)
Gets all authorization information using $DOCKER_CONFIG/.docker/config.json file If missing, an AuthConfigurations object containing only the passed registryCredentials is returned- Parameters:
registryCredentials
- extension of type registryCredentials- Returns:
- AuthConfigurations object containing all authorization information (if available), and the registryCredentials
-
lookupAllAuthConfigs
public com.github.dockerjava.api.model.AuthConfigurations lookupAllAuthConfigs(com.github.dockerjava.api.model.AuthConfig additionalAuthConfig)
Gets all authorization information using $DOCKER_CONFIG/.docker/config.json file If missing, an AuthConfigurations object containing only the passed additionalAuthConfig is returned- Parameters:
additionalAuthConfig
- An additional AuthConfig object to add to the discovered authorization information.- Returns:
- AuthConfigurations object containing all authorization information (if available), and the additionalAuthConfig
-
-