Quarkus-rest-client should support proxy authentication
See original GitHub issueDescription In some infrastructure the outgoing traffic must go through a proxy. And in some cases, this proxy requires basic authentication.
By convention java use these properties to parameters a proxy : http(s).proxyHost http(s).proxyPort http(s).proxyUser http(s).proxyPassword
Although the properties http(s).proxyHost and http(s).proxyPort are supported by quarkus-rest-client, there is no way to specify http(s).proxyUser and http(s).proxyPassword.
Implementation ideas
The problem is that the org.jboss.resteasy.microprofile.client.RestClientBuilderImpl don’t allow setting proxy user and password. When the HttpURLConnection api is used you can specify an Authenticator like this :
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", "0");
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;
}
});
But Resteasy doesn’t seem to use HttpURLConnection 😃
Quarkus should support these properties and inject them (into ClientBuilder ?)
Here a reproducer Thank
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:13 (7 by maintainers)
Top GitHub Comments
Yes, it’s on the roadmap and we made good progress around that.
This was delivered for the Reactive REST Client in https://github.com/quarkusio/quarkus/issues/22466 and it will be available in Quarkus
2.7