diff --git a/CHANGELOG.md b/CHANGELOG.md index 26ba59a70c565..eea3d8f09e48b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -100,6 +100,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), - Fix leafSorter optimization for ReadOnlyEngine and NRTReplicationEngine ([#18639](https://github.com/opensearch-project/OpenSearch/pull/18639)) - Close IndexFieldDataService asynchronously ([#18888](https://github.com/opensearch-project/OpenSearch/pull/18888)) - Fix query string regex queries incorrectly swallowing TooComplexToDeterminizeException ([#18883](https://github.com/opensearch-project/OpenSearch/pull/18883)) +- Fix socks5 user password settings for Azure repo ([#18904](https://github.com/opensearch-project/OpenSearch/pull/18904)) + ### Security diff --git a/plugins/repository-azure/src/main/java/org/opensearch/repositories/azure/AzureStorageService.java b/plugins/repository-azure/src/main/java/org/opensearch/repositories/azure/AzureStorageService.java index 19c9af317247f..1c58f1916e0ed 100644 --- a/plugins/repository-azure/src/main/java/org/opensearch/repositories/azure/AzureStorageService.java +++ b/plugins/repository-azure/src/main/java/org/opensearch/repositories/azure/AzureStorageService.java @@ -59,8 +59,6 @@ import org.opensearch.core.common.unit.ByteSizeValue; import java.io.IOException; -import java.net.Authenticator; -import java.net.PasswordAuthentication; import java.net.URISyntaxException; import java.security.AccessController; import java.security.InvalidKeyException; @@ -209,15 +207,11 @@ private ClientState buildClient(AzureStorageSettings azureStorageSettings, BiCon SocketAccess.doPrivilegedVoidException(() -> { final ProxySettings proxySettings = azureStorageSettings.getProxySettings(); if (proxySettings != ProxySettings.NO_PROXY_SETTINGS) { + final ProxyOptions proxyOptions = new ProxyOptions(proxySettings.getType().toProxyType(), proxySettings.getAddress()); if (proxySettings.isAuthenticated()) { - Authenticator.setDefault(new Authenticator() { - @Override - protected PasswordAuthentication getPasswordAuthentication() { - return new PasswordAuthentication(proxySettings.getUsername(), proxySettings.getPassword().toCharArray()); - } - }); + proxyOptions.setCredentials(proxySettings.getUsername(), proxySettings.getPassword()); } - clientBuilder.proxy(new ProxyOptions(proxySettings.getType().toProxyType(), proxySettings.getAddress())); + clientBuilder.proxy(proxyOptions); } });