Reading https://memorynotfound.com/configure-http-proxy-settings-java/, it says:
Authenticating Proxy
Setting http.proxyUser
and http.proxyPassword
will not automatically authenticate via a proxy.
Taking the above into account. Here is how you can Authenticate via a proxy. This initialisation code is typically executed at application startup. So make sure you register this authenticator before you make any HTTP Requests that require Proxy Authentication.
// settings proxy credentials
System.setProperty("http.proxyUser", "proxyUser");
System.setProperty("http.proxyPassword", "secret");
// Java ignores http.proxyUser. Here come's the workaround.
Authenticator.setDefault(new Authenticator() {
@Override
protected PasswordAuthentication getPasswordAuthentication() {
if (getRequestorType() == RequestorType.PROXY) {
String prot = getRequestingProtocol().toLowerCase();
String host = System.getProperty(prot + ".proxyHost", "");
String port = System.getProperty(prot + ".proxyPort", "80");
String user = System.getProperty(prot + ".proxyUser", "");
String password = System.getProperty(prot + ".proxyPassword", "");
if (getRequestingHost().equalsIgnoreCase(host)) {
if (Integer.parseInt(port) == getRequestingPort()) {
return new PasswordAuthentication(user, password.toCharArray());
}
}
}
return null;
}
});
Is it possible that Xwiki has yet to “learn” to use a proxy with auth the right way??