java.net.http.HttpClient do NOT support Digest authentication while HttpURLConnection do
Daniel Fuchs
daniel.fuchs at oracle.com
Fri Apr 29 09:34:34 UTC 2022
Hi,
java.net.http.HttpClient only supports Basic authentication out
of the box.
Which tutorials are claiming that Digest authentication is supported?
Can you send some links?
At the moment there is no plan to support digest authentication out of
the box. It can be easily implemented at the application level on top
of the existing APIs, by *not* registering an authenticator with
the client and dealing with 401/407 response from the application code.
best regards,
-- daniel
On 28/04/2022 23:40, Farkas Levente wrote:
> Hi,
>
> Even though many tutorial said that the new java.net.http.HttpClient
> support Digest authentication it's not true:
> https://github.com/openjdk/jdk/blob/master/src/java.net.http/share/classes/jdk/internal/net/http/AuthenticationFilter.java#L278
> But at the same time HttpURLConnection support it through the simple:
> -------------------------------
> Authenticator.setDefault(new Authenticator() {
> @Override
> protected PasswordAuthentication getPasswordAuthentication() {
>
> return new PasswordAuthentication (
> "username",
> "password".toCharArray()
> );
> }
> });
> -------------------------------
> Is it a bug or you don't even plan to support it with HttpClient?
> Regards.
>
More information about the core-libs-dev
mailing list