When I access the HTTP server using the standard Java API (java.net.URLConnection), the credentials are "cached" after the first successful authentication, and subsequent calls to Authenticator.setDefault () do not work. So, I need to restart the application in order to use different credentials.
I do not observe this effect when using Basic Authentication. But I need to use NTLM for the server I'm accessing, and Jakarta Commons HttpClient is not an alternative either because it does not support NTLMv2 (see http://oaklandsoftware.com/papers/ntlm.html )
Looking at the packages using Wireshark, I also noticed that before the first successful authentication, authentication is first performed with the current Windows credentials. But after successful authentication, only the saved credentials are used.
Is there a way to reset or change java.net credentials. Does the authenticator use NTLM after successful authentication?
source share