Uploaded image for project: 'HttpComponents HttpClient'
  1. HttpComponents HttpClient
  2. HTTPCLIENT-1381

NullPointerException during NTLM authentication using null workstation/domain

    XMLWordPrintableJSON

Details

    Description

      Using NTCredentials with null workstation or null domain leads to a NullPointerException during the NTLM authentication.

      The workaround is to use an empty String for both the workstation and domain.

      Exception stack trace of an attempt to authenticate with null workstation:
      Exception in thread "main" java.lang.NullPointerException
      at org.apache.http.impl.auth.NTLMEngineImpl.stripDotSuffix(NTLMEngineImpl.java:186)
      at org.apache.http.impl.auth.NTLMEngineImpl.convertHost(NTLMEngineImpl.java:194)
      at org.apache.http.impl.auth.NTLMEngineImpl.access$14(NTLMEngineImpl.java:193)
      at org.apache.http.impl.auth.NTLMEngineImpl$Type1Message.<init>(NTLMEngineImpl.java:970)
      at org.apache.http.impl.auth.NTLMEngineImpl.getType1Message(NTLMEngineImpl.java:139)
      at org.apache.http.impl.auth.NTLMEngineImpl.generateType1Msg(NTLMEngineImpl.java:1608)
      at org.apache.http.impl.auth.NTLMScheme.authenticate(NTLMScheme.java:129)
      at org.apache.http.impl.auth.AuthSchemeBase.authenticate(AuthSchemeBase.java:136)
      at org.apache.http.impl.auth.HttpAuthenticator.doAuth(HttpAuthenticator.java:239)
      at org.apache.http.impl.auth.HttpAuthenticator.generateAuthResponse(HttpAuthenticator.java:202)
      at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:251)
      at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:176)
      at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:77)
      at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:101)
      at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
      at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:115)
      at ClientNtlmProxyAuthentication.main(ClientNtlmProxyAuthentication.java:70)

      Attachments

        1. wire.log
          5 kB
          Ricardo Pereira
        2. ClientNtlmProxyAuthentication.java
          9 kB
          Ricardo Pereira
        3. HTTPCLIENT-1381_patch_tests
          3 kB
          Ricardo Pereira

        Activity

          People

            Unassigned Unassigned
            thc202 Ricardo Pereira
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: