Skip to content

Verify the server authentication (rspauth) provided in the Digest Authentication-Info response per RFC 7616 - #872

Open
arturobernalg wants to merge 1 commit into
apache:masterfrom
arturobernalg:digest-rspauth
Open

Verify the server authentication (rspauth) provided in the Digest Authentication-Info response per RFC 7616#872
arturobernalg wants to merge 1 commit into
apache:masterfrom
arturobernalg:digest-rspauth

Conversation

@arturobernalg

Copy link
Copy Markdown
Member

The client recomputes rspauth from the session state of the last request and compares it to the value returned by the server in constant time, so mutual authentication no longer depends solely on the request being accepted. For qop=auth the cnonce and nc echoed by the server are required and must match the values used for that request, and an Authentication-Info that states qop=auth must carry rspauth, cnonce and nc. Verification is confined to qop=auth; the rspauth of qop=auth-int hashes the response body, which is not available to the scheme. An Authentication-Info without rspauth remains acceptable unless the server states qop=auth.

@arturobernalg
arturobernalg marked this pull request as ready for review August 14, 2026 10:28
Comment thread httpclient5/src/main/java/org/apache/hc/client5/http/impl/auth/DigestScheme.java Outdated
@arturobernalg
arturobernalg force-pushed the digest-rspauth branch 2 times, most recently from 324a033 to 309aff3 Compare August 14, 2026 10:59

@michael-o michael-o left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no formal objection, but cannot reasonable judge on the actual code.

@ok2c ok2c left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@arturobernalg Likewise, I could not spot anything objectionable code-wise, but cannot comment as far as RFC 7616 conformance is concerned. I trust you know what you are doing.

…hentication-Info response per RFC 7616

The client recomputes rspauth from the session state of the last request and compares it to the value returned by the server in constant time, so mutual authentication no longer depends solely on the request being accepted. For qop=auth the cnonce and nc echoed by the server are required and must match the values used for that request, and an Authentication-Info that states qop=auth must carry rspauth, cnonce and nc. Verification is confined to qop=auth; the rspauth of qop=auth-int hashes the response body, which is not available to the scheme. An Authentication-Info without rspauth remains acceptable unless the server states qop=auth.

Authentication-Info is a list field that a server may split across multiple field lines; AuthenticationHandler now combines the parameters from all of them into a single challenge so the scheme sees the complete set rather than only the last line.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants