You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Yannick PIERSON <pi...@gmail.com> on 2008/06/12 19:57:08 UTC

VFS NTLM authentification

Hi,

I would like to make a NTLM authentification but I get this error:

Credentials cannot be used for NTLM authentication:
org.apache.commons.httpclient.UsernamePasswordCredentials
org.apache.commons.httpclient.auth.InvalidCredentialsException: Credentials
cannot be used for NTLM authentication:
org.apache.commons.httpclient.UsernamePasswordCredential

with this simplified code:
StaticUserAuthenticator auth = new StaticUserAuthenticator("domain", "user",
"password");
FileSystemOptions opts = new FileSystemOptions();
DefaultFileSystemConfigBuilder.getInstance().setUserAuthenticator(opts,
auth);
FileObject fo = VFS.getManager().resolveFile("
http://host/Webfolder/my_file.zip", opts);

I would like to use this authentification in order to get a file on a web
folder and then get a FileObject.

I'am able to get it with this code but I would like to get the file across a
VfsJfileChooser:
HttpClient oClient = new HttpClient();
NTCredentials oCredentials = new NTCredentials("user", "password", "host",
"domain");
oClient.getState().setCredentials("domain", "host", oCredentials);
String sOrganizerUrl = "http://" + "host" + "/" +
"Webfolder/my_file.zip";
GetMethod oGetMethod = new GetMethod(sOrganizerUrl);
oGetMethod.setDoAuthentication(true);
oClient.executeMethod(oGetMethod);

I think it's possible to combine jCIFS with commons-vfs but I don't find
how: Authentifications classes cannot be cast.

Thanks,

Regards,

Yannick