Search in sources :

Example 6 with RegistryServerConfiguration

use of org.eclipse.jkube.kit.common.RegistryServerConfiguration in project jkube by eclipse.

the class AuthConfigFactory method getAuthConfigFromSettings.

protected static AuthConfig getAuthConfigFromSettings(List<RegistryServerConfiguration> settings, String user, String registry, UnaryOperator<String> passwordDecryptionMethod) {
    RegistryServerConfiguration defaultServer = null;
    RegistryServerConfiguration found;
    for (RegistryServerConfiguration server : settings) {
        String id = server.getId();
        // Remember a default server without user as fallback for later
        if (defaultServer == null) {
            defaultServer = checkForServer(server, id, registry, null);
        }
        // Check for specific server with user part
        found = checkForServer(server, id, registry, user);
        if (found != null) {
            return createAuthConfigFromServer(found, passwordDecryptionMethod);
        }
    }
    return defaultServer != null ? createAuthConfigFromServer(defaultServer, passwordDecryptionMethod) : null;
}
Also used : RegistryServerConfiguration(org.eclipse.jkube.kit.common.RegistryServerConfiguration)

Aggregations

RegistryServerConfiguration (org.eclipse.jkube.kit.common.RegistryServerConfiguration)6 ArrayList (java.util.ArrayList)2 AuthConfig (org.eclipse.jkube.kit.build.api.auth.AuthConfig)2 Test (org.junit.Test)2 JsonObject (com.google.gson.JsonObject)1 JsonPrimitive (com.google.gson.JsonPrimitive)1 AwsSdkAuthConfigFactory (org.eclipse.jkube.kit.build.service.docker.auth.ecr.AwsSdkAuthConfigFactory)1 JKubeConfiguration (org.eclipse.jkube.kit.common.JKubeConfiguration)1 HelmServiceUtil.selectHelmRepository (org.eclipse.jkube.kit.resource.helm.HelmServiceUtil.selectHelmRepository)1