You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Al...@Finaris.de on 2011/04/20 10:03:09 UTC
CXF consumer always uses my local Windows credentials for NTLM
authentification
Hi List,
I want to connect to an Microsoft IIS Server using NTLM authentification.
The used classes are generated with CXF wsdl2java tool.
To retrieve the wsdl file while creating the port Object i use the jcifs
libs, works great.
For the request itself i configured the AuthorizationPolicy.
Ok here my Problem:
CXF (2.4.0) always using my local Windows credentials for authenticating,
not the credentials i provided.
If i start the Program with unauthorized credentials the first connection
fails, and CXF used the - correct - provided credentials.
I want CXF to always use the provided credentials, note my current Windows
credentials, but i cant find any configuration for this.
Heres my Java Code:
public static void main(String[] args) {
//Set the jcifs properties to be able to retrieve the WSDL
while creating locationWebService Object
jcifs.Config.setProperty("jcifs.smb.client.domain",
"tf-pc");
jcifs.Config.setProperty("jcifs.smb.client.soTimeout",
"300000"); //5 minutes
jcifs.Config.setProperty("jcifs.netbios.cachePolicy",
"1200"); //20 minutes
jcifs.Config.setProperty("jcifs.smb.client.username",
"username");
jcifs.Config.setProperty("jcifs.smb.client.password",
"pass");
//Register the jcifs URL handler to enable NTLM
jcifs.Config.registerSmbURLHandler();
URL wsdlurl = null;
try {
wsdlurl = new URL("
http://tf-pc:8080/tfs/TeamFoundation/Administration/v3.0/LocationService.asmx?WSDL
");
} catch (MalformedURLException e) {
e.printStackTrace();
}
LocationWebService locationWebService = new
LocationWebService(wsdlurl, new QName("http://microsoft.com/webservices/",
"LocationWebService"));
LocationWebServiceSoap port =
locationWebService.getLocationWebServiceSoap();
// configuring HTTP Proxy to prevent chunking
// see
https://cwiki.apache.org/CXF20DOC/client-http-transport-including-ssl-support.html
Client clientLocationWebService = ClientProxy.getClient
(port);
HTTPConduit http = (HTTPConduit)
clientLocationWebService.getConduit();
HTTPClientPolicy httpClientPolicy = new
HTTPClientPolicy();
httpClientPolicy.setAllowChunking(false);
http.setClient(httpClientPolicy);
//http.getAuthorization().setAuthorizationType("Negotiate");
http.getAuthorization().setUserName("username");
http.getAuthorization().setPassword("pass");
ConnectionData resp = port.connect(0, null, 0);
System.out.println("Connected as User: " +
resp.getAuthenticatedUser().getDisplayName());
}
Latest Java 6 is used.
Hope anyone can help me with this.
With best regards,
Alexander Schulz
F I N A R I S
Financial Software Partner GmbH
Sömmerringstrasse 23
60322 Frankfurt am Main
Fon: +49 (0)69 / 254 98 - 29
Fax: +49 (0)69 / 254 98 - 50
eMail: mailto:Alexander.Schulz@finaris.de
www: http://www.finaris.de und http://www.rapidrep.com
=======================================================
Disclaimer
The information contained in this e - mail and any attachments
( together the "message") is intended for the addressee only and may
contain confidential and/or privileged information. If you have received
the message by mistake please delete it and notify the sender and do
not copy or distribute it or disclose its contents to anyone.
FINARIS Financial Software Partner GmbH
Sömmerringstr. 23, 60322 Frankfurt/Main, Germany
Registered at Frankfurt/Main, HRB 52873
Managing Directors:
Dipl. Inf. Hermann Friebel, Dipl. Ing. Kai Bächle, Dipl. Inf. Werner Märkl
=======================================================