public class AuthConfigFactory extends Object
Modifier and Type | Class and Description |
---|---|
protected static class |
AuthConfigFactory.LookupMode |
Constructor and Description |
---|
AuthConfigFactory(KitLogger log) |
Modifier and Type | Method and Description |
---|---|
AuthConfig |
createAuthConfig(boolean isPush,
boolean skipExtendedAuth,
Map authConfig,
List<RegistryServerConfiguration> settings,
String user,
String registry,
UnaryOperator<String> passwordDecryptionMethod)
Create an authentication config object which can be used for communication with a Docker registry
The authentication information is looked up at various places (in this order):
From system properties
From the provided map which can contain key-value pairs
From the openshift settings in ~/.config/kube
From the Maven settings stored typically in ~/.m2/settings.xml
From the Docker settings stored in ~/.docker/config.json
The following properties (prefix with 'docker.') and config key are evaluated:
username: User to authenticate
password: Password to authenticate.
|
protected static AuthConfig |
getAuthConfigFromDockerConfig(String registry,
KitLogger log) |
protected static AuthConfig |
getAuthConfigFromOpenShiftConfig(AuthConfigFactory.LookupMode lookupMode,
Map authConfigMap) |
protected static AuthConfig |
getAuthConfigFromPluginConfiguration(AuthConfigFactory.LookupMode lookupMode,
Map<String,?> authConfig,
UnaryOperator<String> passwordDecryptionMethod) |
protected static AuthConfig |
getAuthConfigFromSettings(List<RegistryServerConfiguration> settings,
String user,
String registry,
UnaryOperator<String> passwordDecryptionMethod) |
protected static AuthConfig |
getAuthConfigFromSystemProperties(AuthConfigFactory.LookupMode lookupMode,
UnaryOperator<String> passwordDecryptionMethod) |
public AuthConfigFactory(KitLogger log)
public AuthConfig createAuthConfig(boolean isPush, boolean skipExtendedAuth, Map authConfig, List<RegistryServerConfiguration> settings, String user, String registry, UnaryOperator<String> passwordDecryptionMethod) throws IOException
isPush
- if true this AuthConfig is created for a push, if false it's for a pullskipExtendedAuth
- if false, do not execute extended authentication methodsauthConfig
- String-String Map holding configuration info from the plugin's configuration. Can be null
in
which case the settings are consulted.settings
- the global Maven settings objectuser
- user to check forregistry
- registry to use, might be null in which case a default registry is checked,passwordDecryptionMethod
- a functional interface to customize how password should be decodednull
if none could be foundIOException
- mojo failure exceptionprotected static AuthConfig getAuthConfigFromSystemProperties(AuthConfigFactory.LookupMode lookupMode, UnaryOperator<String> passwordDecryptionMethod) throws IOException
IOException
protected static AuthConfig getAuthConfigFromOpenShiftConfig(AuthConfigFactory.LookupMode lookupMode, Map authConfigMap)
protected static AuthConfig getAuthConfigFromPluginConfiguration(AuthConfigFactory.LookupMode lookupMode, Map<String,?> authConfig, UnaryOperator<String> passwordDecryptionMethod)
protected static AuthConfig getAuthConfigFromSettings(List<RegistryServerConfiguration> settings, String user, String registry, UnaryOperator<String> passwordDecryptionMethod)
protected static AuthConfig getAuthConfigFromDockerConfig(String registry, KitLogger log) throws IOException
IOException
Copyright © 2020. All rights reserved.