r***@gmail.com
2014-04-24 16:14:19 UTC
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
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