You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "ASF subversion and git services (Jira)" <ji...@apache.org> on 2020/07/01 10:29:00 UTC

[jira] [Commented] (HTTPCLIENT-2086) NTLM Message parse Error

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

ASF subversion and git services commented on HTTPCLIENT-2086:
-------------------------------------------------------------

Commit da28440a58c381abcbd34d648372a819902fabfd in httpcomponents-client's branch refs/heads/master from Oleg Kalnichevski
[ https://gitbox.apache.org/repos/asf?p=httpcomponents-client.git;h=da28440 ]

RFC 7235 compliance, HTTPCLIENT-2086: fixed parsing of token68 based (base64-encoded) auth schemes.


> NTLM Message parse Error
> ------------------------
>
>                 Key: HTTPCLIENT-2086
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-2086
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>    Affects Versions: 5.0
>            Reporter: Michael Wagner
>            Priority: Minor
>             Fix For: 5.0.2
>
>         Attachments: ntlm 407 log and stacktrace.txt, ntlm working.txt, screenshot-1.png
>
>          Time Spent: 1h 40m
>  Remaining Estimate: 0h
>
> My Authentication endpoint returns an NTLM Message header like this:
> {code}
> "WWW-Authenticate: NTLM TlRMTVNTUAACAAAABgAGADgAAAAF.....QByAGcALgBkAGUABwAIAMG9LHviQtYBAAAAAA=="
> {code}
> Upon reading this header with {{AuthChallengeParser}} hc parses this field using the code in [line 70|https://github.com/apache/httpcomponents-client/blob/3730b03a99308ff99769fdd60e80a43230cf5aac/httpclient5/src/main/java/org/apache/hc/client5/http/impl/auth/AuthChallengeParser.java#L70]:
> {code}
> if (!cursor.atEnd() && buffer.charAt(cursor.getPos()) == EQUAL_CHAR) {
>                 cursor.updatePos(cursor.getPos() + 1);
>                 final String value = tokenParser.parseValue(buffer, cursor, DELIMITER);
>                 return new BasicNameValuePair(token, value);
> }
> {code}
> When reading the first "=" char of the message, it interprets the value as a key-value pair. The first part of the NTLM message being the key and the second "=" the value. [Later|https://github.com/apache/httpcomponents-client/blob/3730b03a99308ff99769fdd60e80a43230cf5aac/httpclient5/src/main/java/org/apache/hc/client5/http/impl/auth/AuthChallengeParser.java#L126] an AuthChallenge is later created with
> {code}
> new AuthChallenge(challengeType, schemeName, null, params.size() > 0 ? params : null);
> {code}
> where {{value}} is null and params a list containing the NTLM message without the equals signs. 
> Without the "==" the next auth step fails.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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