Ilana Kupershmidt created WINK-382:
--------------------------------------

             Summary: ProxyAuthSecurityHandler returns java.io.IOException: 
Unable to tunnel through proxy. Proxy returns "HTTP/1.1 407 Proxy Auth Required"
                 Key: WINK-382
                 URL: https://issues.apache.org/jira/browse/WINK-382
             Project: Wink
          Issue Type: Bug
          Components: Client
    Affects Versions: 1.2
         Environment: JBoss, http proxy, server over https
            Reporter: Ilana Kupershmidt


I try to connect to a server via https that requires authentication.Moreover, I 
have an http proxy in the middle that also requires authentication.
I use ProxyAuthSecurityHandler to authenticate with the proxy and 
BasicAuthSecurityHandler to authenticate with the server.
Receiving java.io.IOException: Unable to tunnel through proxy. Proxy returns 
"HTTP/1.1 407 Proxy Auth Required"
 at 
sun.net.www.protocol.http.HttpURLConnection.doTunneling(HttpURLConnection.java:1525)
 at 
sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:164)
 at 
sun.net.www.protocol.https.HttpsURLConnectionImpl.connect(HttpsURLConnectionImpl.java:133)
 at 
org.apache.wink.client.internal.handlers.HttpURLConnectionHandler.processRequest(HttpURLConnectionHandler.java:97)
 
 I noticed that the implementation of ProxyAuthSecurityHandler is expecting 
response code 407 however, during debug we never get to the second part due to 
the IOException thrown. 

 Code snap:

        ClientConfig configuration = new ClientConfig();
        configuration.connectTimeout(timeout);

        MyBasicAuthenticationSecurityHandler basicAuthProps = new 
MyBasicAuthenticationSecurityHandler();
        basicAuthProps.setUserName(user);
        basicAuthProps.setPassword(password);
        configuration.handlers(basicAuthProps);

        if ("true".equals(System.getProperty("setProxy"))) {
                configuration.proxyHost(proxyHost);
                if ((proxyPort != null) && !proxyPort.equals("")) {
                        configuration.proxyPort(Integer.parseInt(proxyPort));
                }

                MyProxyAuthSecurityHandler proxyAuthSecHandler =
                                new MyProxyAuthSecurityHandler();
                proxyAuthSecHandler.setUserName(proxyUser);
                proxyAuthSecHandler.setPassword(proxyPass);
                configuration.handlers(proxyAuthSecHandler);
        }

        restClient = new RestClient(configuration);
        // create the createResourceWithSessionCookies instance to interact with

        Resource resource = getResource(loginUrl);

        // Request body is empty
        ClientResponse response = resource.post(null); 
        
Tried using wink client versions 1.1.2 and also 1.2.1. the issue repeats in 
both.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to