[ 
https://issues.apache.org/jira/browse/HTTPCLIENT-2199?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17481124#comment-17481124
 ] 

can commented on HTTPCLIENT-2199:
---------------------------------

For this ntlm issue, there is no exception but I can share log files.
Inside "NoRequestAfter2ndResponse.txt", there is an outgoing GET request and 
then a response with header => Www-Authenticate: NTLM
Then 2nd GET request is executed with Authorization header and then a new 
challenge is received with header => Www-Authenticate: NTLM 
TlRMTVNTUAACAAAAAAAAACgAAAABAAAAAAAAAAAAAAA=
And then, in the end of the logs, we see message "Authentication failed"
There should be one more HTTP GET request to complete authentication.
[^NoRequestAfter2ndResponse.txt]
Here is another log with an external Authenticator (which process NTLM 
challenge properly)
[^RequestAfter2ndResponse.txt]

 

Kotlin sample code to reproduce issue (only 2 GET requests executed) on Android
{noformat}
            val credentialStore: CredentialsStore = BasicCredentialsProvider()
            credentialStore.setCredentials(
                    AuthScope(null, null, -1, null, "NTLM"),
                    NTCredentials("test", "test".toCharArray(), null, null))

            val httpClient = HttpClients.custom()
                    .setDefaultCredentialsProvider(credentialStore)
                    .build()

            val request = HttpGet("http://ntlm.herokuapp.com/";)
            request.config = RequestConfig.custom()
                    .setTargetPreferredAuthSchemes(listOf("NTLM"))              
                         
                    .setAuthenticationEnabled(true).build()

            var response: CloseableHttpResponse? = null
            try {
                response = httpClient.execute(request)
            } catch (e: Exception) {
                e.printStackTrace()
            }
            response?.close()
            httpClient.close()
{noformat}

> NTLM authentication not working
> -------------------------------
>
>                 Key: HTTPCLIENT-2199
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-2199
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: HttpClient (classic)
>    Affects Versions: 5.1.2
>            Reporter: can
>            Priority: Major
>         Attachments: 150694519-4216bb91-ad43-40d1-ba8e-1818af685560.png
>
>
> In NTLMScheme class (NTLMScheme.java), processChallenge function is trying to 
> read challenge using getValue() function.
> But it is always returning null.
> Challenge is actually stored inside params and can be accessed by getParams() 
> function.
> see https://github.com/ok2c/httpclient-android-ext/issues/3



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

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

Reply via email to