diff --git a/parent-pom.xml b/parent-pom.xml index ab6948da5..69a96e57d 100644 --- a/parent-pom.xml +++ b/parent-pom.xml @@ -25,7 +25,7 @@ 1.8.1 4.2.0 1.12.655 - 5.0.0 + 8.6.6 1.74 1.0.2.4 1.0.5 diff --git a/src/main/java/net/snowflake/client/core/HttpUtil.java b/src/main/java/net/snowflake/client/core/HttpUtil.java index 166bd7e0a..fb3cf7552 100644 --- a/src/main/java/net/snowflake/client/core/HttpUtil.java +++ b/src/main/java/net/snowflake/client/core/HttpUtil.java @@ -227,9 +227,19 @@ public static void setProxyForAzure(HttpClientSettingsKey key, OperationContext if (key != null && key.usesProxy()) { Proxy azProxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(key.getProxyHost(), key.getProxyPort())); - logger.debug( - "Setting Azure proxy. Host: {}, port: {}", key.getProxyHost(), key.getProxyPort()); opContext.setProxy(azProxy); + boolean setProxyUser = + !Strings.isNullOrEmpty(key.getProxyUser()) + && !Strings.isNullOrEmpty(key.getProxyPassword()); + logger.debug( + "Setting Azure proxy {} user. Host: {}, port: {}", + setProxyUser ? "with" : "without", + key.getProxyHost(), + key.getProxyPort()); + if (setProxyUser) { + opContext.setProxyUsername(key.getProxyUser()); + opContext.setProxyPassword(key.getProxyPassword()); + } } else { logger.debug("Omitting Azure proxy setup"); } diff --git a/src/test/java/net/snowflake/client/core/CoreUtilsMiscellaneousTest.java b/src/test/java/net/snowflake/client/core/CoreUtilsMiscellaneousTest.java index f11614c8b..87df6c659 100644 --- a/src/test/java/net/snowflake/client/core/CoreUtilsMiscellaneousTest.java +++ b/src/test/java/net/snowflake/client/core/CoreUtilsMiscellaneousTest.java @@ -162,6 +162,8 @@ public void testSetProxyForAzure() { false); HttpUtil.setProxyForAzure(testKey, op); Proxy proxy = op.getProxy(); + assertEquals("testuser", op.getProxyUsername()); + assertEquals("pw", op.getProxyPassword()); assertEquals(Proxy.Type.HTTP, proxy.type()); assertEquals(new InetSocketAddress("snowflakecomputing.com", 443), proxy.address()); }