You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by Chris Mugdan <ch...@integeo.com> on 2019/01/19 00:29:30 UTC
HttpClient 4.5 - make NTLM highest precedence authenticator when
using HttpClientBuilder
Hi,
I am using HttpClientBuilder to create an HttpClient with NTLM
authentication, but looking at the logs it tries SPNEGO first then NTLM.
Since I am only interested in NTLM, to increase the efficiency of
requests I want it to be the first authenticator tried. How do I do this
when I am using the following code to set up the HttpClient?
{
.......
HttpClientBuilder clientBuilder = HttpClients.custom()
.useSystemProperties()
.setUserAgent("Mozilla/5.0");
// authentication/credentials...
if (credsProvider == null)
{
credsProvider = new BasicCredentialsProvider();
final NTCredentials credentials =
new NTCredentials(username, password, workstation, domain);
credsProvider.setCredentials(AuthScope.ANY, credentials);
}
clientBuilder =
clientBuilder.setDefaultCredentialsProvider(credsProvider);
return Executor.newInstance(clientBuilder.build());
}
--
Untitled Document
*Christopher Mugdan *
Senior Software Developer
Phone: +61 (0)2 9045 3391
Mobile: +61 (0)412 398 104
Email: chrism@integeo.com <mailto:chrism@integeo.com%20>
Skype: chrismugdan
www.integeo.com <https://www.integeo.com>
Re: HttpClient 4.5 - make NTLM highest precedence authenticator
when using HttpClientBuilder
Posted by Oleg Kalnichevski <ol...@apache.org>.
On Sat, 2019-01-19 at 11:29 +1100, Chris Mugdan wrote:
> Hi,
>
> I am using HttpClientBuilder to create an HttpClient with NTLM
> authentication, but looking at the logs it tries SPNEGO first then
> NTLM.
> Since I am only interested in NTLM, to increase the efficiency of
> requests I want it to be the first authenticator tried. How do I do
> this
> when I am using the following code to set up the HttpClient?
>
See `targetPreferredAuthSchemes` and `proxyPreferredAuthSchemes`
attributes of the `RequestConfig` class.
Oleg
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org