openstack4j / openstack4j

Fluent OpenStack SDK for Java
https://openstack4j.github.io/
Apache License 2.0
110 stars 92 forks source link

authenticate() with proxy and required proxy authentication fails with: ClientResponseException{message=Proxy Authentication Required, status=407, status-code=PROXY_AUTH_REQUIRED} #50

Open lweberru opened 4 years ago

lweberru commented 4 years ago

Hi,

Description: openstack authentication not working when behind a proxy with user and password authentication. It fails with:

ClientResponseException{message=Proxy Authentication Required, status=407, status-code=PROXY_AUTH_REQUIRED}
    at org.openstack4j.core.transport.HttpExceptionHandler.mapException(HttpExceptionHandler.java:38)
    at org.openstack4j.core.transport.HttpExceptionHandler.mapException(HttpExceptionHandler.java:23)
    at org.openstack4j.openstack.internal.OSAuthenticator.authenticateV3(OSAuthenticator.java:191)
    at org.openstack4j.openstack.internal.OSAuthenticator.invoke(OSAuthenticator.java:74)
    at org.openstack4j.openstack.client.OSClientBuilder$ClientV3.authenticate(OSClientBuilder.java:172)
    at org.openstack4j.openstack.client.OSClientBuilder$ClientV3.authenticate(OSClientBuilder.java:129)

Reproduce with: Use a proxy with required authentication Version: openstack4j 3.4 (maven) any java version

        OSClientV3 os=null; 
        V3 builder = OSFactory.builderV3()
                .endpoint(keystoneUrl)
                .credentials("user", "password", Identifier.byId("domainId"));
        builder=builder.withConfig(Config.newConfig().withProxy(ProxyHost.of("http://proxyHost", proxyPort, "proxyUser", "proxyPassword")));
        builder=builder.scopeToProject(Identifier.byName("project"),Identifier.byId("domainId"));
        os=builder.authenticate();

I debuged a bit and saw that in the method: org.openstack4j.connectors.resteasy.executors.ApacheHttpClientEngine.create() the proxy information is used but not username and password

Regards Lukas

lweberru commented 4 years ago

Any news on this?

bboyHan commented 3 years ago

I review the code. It does have this problem because of his ProxyHost is org.apache.http.HttpHost

titoustaff commented 3 years ago

I have the same probleme, PROXY_AUTH_REQUIRED