question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Quarkus-rest-client should support proxy authentication

See original GitHub issue

Description 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:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:13 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
cescoffiercommented, Nov 23, 2020

Yes, it’s on the roadmap and we made good progress around that.

0reactions
geoandcommented, Jan 11, 2022

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using the REST Client Reactive - Quarkus
REST Client Reactive supports sending requests through a proxy. It honors the JVM settings for it but also allows to specify both: global...
Read more >
How to configure proxy setting for rest client in Quarkus
How do I configure proxy setting for MicroProfile rest client style code as below in Quarkus? Raw. import org.eclipse.microprofile.rest.client.
Read more >
Quarkus / Restclient with proxy configuration - Stack Overflow
I am using quarkus 1.10.5.Final and need to call web service with web proxy. Currently my code using microprofile client proxy and put...
Read more >
Quarkus Cheat-Sheet
Bean Validation is also supported so properties are validated at ... start using it you need to add the quarkus-rest-client-mutiny. ... proxy.endpoint.
Read more >
How To Authenticate Proxy Using Quarkusmicroprofile ...
In this guide we will be demonstrating how to consume part of the REST API supplied by the stage.code.quarkus.io service.Our first order of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found