Jetty HttpClient proxy authentication configuration (NTLM)

813 Views Asked by At

We built a Java client application connecting to an API behind a proxy that demands NTLM authentication. The application uses a Jetty HttpClient.

Unfortunately the authentication fails with a 407

Response headers HttpResponse[HTTP/1.1 407 Proxy Authorization Required]@3577846e
Proxy-Authenticate: Negotiate
Proxy-Authenticate: NTLM

We tried to authenticate using the SPNEGOAuthentication-class

AuthenticationStore authStore = httpClient.getAuthenticationStore();
SPNEGOAuthentication auth = new SPNEGOAuthentication(proxyUrl);
auth.setUserName(user);
auth.setUserPassword(password);
authStore.addAuthentication(auth);

ProxyConfiguration proxyConfig = httpClient.getProxyConfiguration();

HttpProxy proxy = new HttpProxy(proxyUrl.getHost(), proxyUrl.getPort());
proxyConfig.getProxies().add(proxy);

But without success (407). We also tried overwriting the DefaultAuthenticator.

Any hints what we probably did wrong or other suggestions?

Regards and thanks in advance, Thomas

0

There are 0 best solutions below