hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Carina Lansing (JIRA)" <j...@apache.org>
Subject [jira] [Created] (HTTPCLIENT-1446) Proxy authentication Error - NTLM authentication error: Unexpected state: MSG_TYPE3_GENERATED in Http Client 4.3.1
Date Thu, 09 Jan 2014 23:25:51 GMT
Carina Lansing created HTTPCLIENT-1446:

             Summary: Proxy authentication Error - NTLM authentication error: Unexpected state:
MSG_TYPE3_GENERATED in Http Client 4.3.1
                 Key: HTTPCLIENT-1446
                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1446
             Project: HttpComponents HttpClient
          Issue Type: Bug
          Components: HttpClient
    Affects Versions: 4.3.1
         Environment: Windows 7
            Reporter: Carina Lansing

We are using httpclient 4.3.1, trying to connect to a website that requires basic authentication
through an NTLM v2 proxy.  It appears that the proxy authentication is successfully negotiated,
but then when trying to process the challenge from the target web site in the next pass, the
NTLMScheme is throwing this exception at line  147?  We are instantiating our http client
via the snippet shown below.  Attached is a debug trace of the HttpGet  operation.
    ConnectionConfig connectionConfig = ConnectionConfig.custom()

    this.connManager = new PoolingHttpClientConnectionManager();

    // Configure the connection manager to use connection configuration

    // Configure total max or per route limits for persistent connections
    // that can be kept in the pool or leased by the connection manager.

    // Create global request configuration
    this.defaultRequestConfig = RequestConfig.custom()
        .setProxyPreferredAuthSchemes(Arrays.asList(AuthSchemes.BASIC, AuthSchemes.NTLM))
    // Set the route planner with our Proxy Selector which should auto-determine the proxy
    SystemDefaultRoutePlanner routePlanner = new SystemDefaultRoutePlanner(ProxyConfig.getProxySelector());

    // Use custom credentials provider to set credentials for server and proxy
    CredentialsProvider credentialsProvider = new BasicCredentialsProvider();     

    // Set credentials for velo server
        new AuthScope(this.server, this.port), // velo server and port (i.e., akuna.labworks.org:80)
        new UsernamePasswordCredentials(username, password));

    // Set credentials for proxy
    if(ProxyConfig.getHost() != null && ProxyConfig.getProxyUsername() != null) {
      // basic scheme
          new AuthScope(ProxyConfig.getHost(), ProxyConfig.getPort(), new BasicScheme().getSchemeName()),
          new UsernamePasswordCredentials(ProxyConfig.getProxyUsername(), ProxyConfig.getProxyPassword()));

      // NTLM scheme
          new AuthScope(ProxyConfig.getHost(), ProxyConfig.getPort(), AuthScope.ANY_REALM,
new NTLMScheme().getSchemeName()),
          new NTCredentials(ProxyConfig.getProxyUsername(), ProxyConfig.getProxyPassword(),
              ProxyConfig.getClientMachine(), ProxyConfig.getClientDomain()));  
    // Configure for https
    SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(sslContext,
    // Create an HttpClient with the given custom dependencies and configuration.
    CloseableHttpClient httpclient = HttpClients.custom()
        //         .setProxy(new HttpHost("myproxy", 8080)) // don't need to set proxy since
routePlanner should do it

This message was sent by Atlassian JIRA

To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org

View raw message