Skip to content

Commit

Permalink
SNOW-1651983 authenticated proxy on azure
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-mhofman committed Sep 5, 2024
1 parent 21c1e32 commit b2ab542
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion parent-pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<avro.version>1.8.1</avro.version>
<awaitility.version>4.2.0</awaitility.version>
<awssdk.version>1.12.655</awssdk.version>
<azure.storage.version>5.0.0</azure.storage.version>
<azure.storage.version>8.6.6</azure.storage.version>
<bouncycastle.version>1.74</bouncycastle.version>
<bouncycastle.bcfips.version>1.0.2.4</bouncycastle.bcfips.version>
<bouncycastle.bcpkixfips.version>1.0.5</bouncycastle.bcpkixfips.version>
Expand Down
10 changes: 6 additions & 4 deletions src/main/java/net/snowflake/client/core/HttpUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
Expand Down

0 comments on commit b2ab542

Please sign in to comment.