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;
}
Aggregations