Discussion:
how to pass credentials to AcquireCredentialsHandle?
(too old to reply)
r***@gmail.com
2014-04-24 16:14:19 UTC
Permalink
Hello-

I am working on a java HTTP client that could support native NTLM/Negotiate using JNA (inspired by https://github.com/dblock/waffle)

I have this working when using the currently logged in user credentials, but am struck getting it to work with with a configurable username/password.

I can successfully call:
Advapi32.INSTANCE.LogonUser(username, domain, password, logonType,
logonProvider, phUser)

and then have tried:
Advapi32.INSTANCE.ImpersonateLoggedOnUser(windowsIdentity)

but this is not working. The docs for 'AcquireCredentialsHandle' say

"These can be either preexisting credentials, which are established through a system logon that is not described here"
http://msdn.microsoft.com/en-us/library/windows/desktop/aa374712(v=vs.85).aspx

Any pointers on how to pass credentials to AcquireCredentialsHandle? In JNA, the signature for AcquireCredentialsHandle is:

public int AcquireCredentialsHandle(
String pszPrincipal, String pszPackage,
int fCredentialUse, LUID pvLogonID,
Pointer pAuthData, Pointer pGetKeyFn,
Pointer pvGetKeyArgument, CredHandle phCredential,
TimeStamp ptsExpiry);

Any ideas? Sorry if this is off-topic

thanks
Ryan
r***@gmail.com
2014-04-24 16:16:39 UTC
Permalink
here is a link to an unreleased early draft just for the record:
http://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk/httpclient-win/src/main/java/org/apache/http/impl/auth/win/

thanks
ryan

Loading...