Skip to content

Digest auth new #2098

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
Draft

Digest auth new #2098

wants to merge 7 commits into from

Conversation

pratt4
Copy link
Contributor

@pratt4 pratt4 commented Jun 10, 2025

This is build on top of #2089

and still some changes are required around new testcases and failing testcases

closes #2068

@pratt4 pratt4 marked this pull request as draft June 10, 2025 14:42
@hyperxpro
Copy link
Member

I'll have a look on the weekend. :)

@pratt4 pratt4 force-pushed the digest-auth-new branch 2 times, most recently from db10c8e to 735ab1c Compare June 15, 2025 07:12
@pratt4 pratt4 force-pushed the digest-auth-new branch from 735ab1c to 126404c Compare June 15, 2025 07:30
@hyperxpro
Copy link
Member

I think only the auth-int implementation is not complete.

@pratt4
Copy link
Contributor Author

pratt4 commented Jun 18, 2025

Thanks @hyperxpro for pointing that out! I’ve started implementing auth-int
I will push phase 1 in 1-2 days

@pratt4 pratt4 mentioned this pull request Jul 20, 2025
@pratt4
Copy link
Contributor Author

pratt4 commented Jul 20, 2025

things to do

  • Support unlimited size request bodies using streaming: implement DigestingBodyGenerator that hashes while streaming (no upfront buffer), lifting the 10 MB limit
  • Adding a repeatability contract (e.g... isRepeatable()) to BodyGenerator so client auto-selects buffering or streaming modes
  • Optimization of FileBodyGenerator hashing by using zero-copy techniques (FileChannel + ByteBuffer or mmmap slices).
  • seamless auth-int support for ReactiveStreams and multipart body generators, preserving async back-pressure.
  • Negotiation of strongest hash algorithm automatically when server advertises multiple options (SHA-512-256 first, then SHA-256, then MD5).
  • Implementation of the RFC 7616 userhash=true parameter and handle UTF-8 encoded usernames properly.
  • Performance improvements on hex-encoding method with lookup-table-based implementation and consider mmap-based hashing.
  • Integration tests

@pratt4
Copy link
Contributor Author

pratt4 commented Jul 20, 2025

@hyperxpro i have fews questions it would be helpfull if you answer them

1)in Proxy auth is auth-int relevant? because as far as i know proxies happen before getting body
2) currently i dont think the code increments nonce infact it uses DEFAULT_NC=00000001
that means every request that uses Digest today sends nc="00000001". Most servers tolerate that because they don’t enforce nonce-count, but a strict implementation (especially when it also requires auth-int) will expect the counter to rise.
shall we increment it or it is kept default for some reason?

Thanks!

* @return 2×length lower-case hex string
* @throws IllegalArgumentException if {@code bytes} is null
*/
public static String bytesToHex(byte[] bytes) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

need to optimize this

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.

any plan for RFC7616?
2 participants