Skip to content

Commit

Permalink
Made it so authentication with the proxy username and password
Browse files Browse the repository at this point in the history
in the config is only done when the requesting host and port matches
the proxy host and port in the config.
  • Loading branch information
krisleonard-mcafee committed Jul 11, 2019
1 parent cc9f2ce commit 86a7e35
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/main/java/com/opendxl/client/DxlClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -1370,8 +1370,15 @@ private synchronized void doConnect(final Map<String, Broker> brokers)
Authenticator.setDefault(new Authenticator() {
@Override
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(
getConfig().getProxyUserName(), getConfig().getProxyPassword());
// Only use the proxy username and password in the config if the requesting host and port
// matches the proxy host address and port in the config
if (getRequestingHost().equalsIgnoreCase(getConfig().getProxyAddress())
&& getRequestingPort() == getConfig().getProxyPort()) {
return new PasswordAuthentication(
getConfig().getProxyUserName(), getConfig().getProxyPassword());
}

return null;
}
});
}
Expand Down

0 comments on commit 86a7e35

Please sign in to comment.