You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by David Robison <da...@psgglobal.net> on 2017/01/18 14:59:29 UTC

Attempting NTLM authentication but CXF tries NEGOTIATE first

I have a system that I am trying to authenticate with via NTLM. Here is my code snippet:

Bus bus = BusFactory.getDefaultBus();
bus.setProperty(AsyncHTTPConduit.USE_ASYNC, Boolean.TRUE);

proxy = new ServerCommandService().getServerCommandServiceSoap();
Client client = ClientProxy.getClient(proxy);
client.getRequestContext().put("use.async.http.conduit", Boolean.TRUE);
client.getRequestContext().put(Message.ENDPOINT_ADDRESS, serverURL) ;
AsyncHTTPConduit httpConduit = (AsyncHTTPConduit)client.getConduit();

HTTPClientPolicy httpClientPolicy = httpConduit.getClient();
httpClientPolicy.setConnectionTimeout(36000);
httpClientPolicy.setAllowChunking(false);
httpClientPolicy.setAutoRedirect(true);

Credentials credentials = new NTCredentials(username, password, null, domain);
client.getRequestContext().put(Credentials.class.getName(), credentials);

When I run the program, CXF first tries to do NEGOTIATE which fails after about 20s and then it does NTLM which succeeds in less than a second. Is there a way I can disable CXF from attempting NEGOTIATE first?

Thanks, David

David R Robison
Senior Systems Engineer
O. +1 512 247 3700
M. +1 757 286 0022
david.robison@psgglobal.net<ma...@psgglobal.net>
www.psgglobal.net<http://www.psgglobal.net/>

Prometheus Security Group Global, Inc.
3019 Alvin Devane Boulevard
Building 4, Suite 450
Austin, TX 78741