diff --git a/parent-pom.xml b/parent-pom.xml index 28412d161..9fecf4ea3 100644 --- a/parent-pom.xml +++ b/parent-pom.xml @@ -24,7 +24,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..b55755b9a 100644 --- a/src/main/java/net/snowflake/client/core/HttpUtil.java +++ b/src/main/java/net/snowflake/client/core/HttpUtil.java @@ -225,11 +225,13 @@ public static void setSessionlessProxyForAzure( */ public static void setProxyForAzure(HttpClientSettingsKey key, OperationContext opContext) { 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()); + Proxy azProxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(key.getProxyHost(), key.getProxyPort())); opContext.setProxy(azProxy); + if (!Strings.isNullOrEmpty(key.getProxyUser()) && !Strings.isNullOrEmpty(key.getProxyPassword())) { + logger.debug("Setting Azure proxy with user. Host: {}, port: {}", key.getProxyHost(), key.getProxyPort()); + 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..8a1d24ab4 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.getProxyUsername()); assertEquals(Proxy.Type.HTTP, proxy.type()); assertEquals(new InetSocketAddress("snowflakecomputing.com", 443), proxy.address()); }