I'm running inside a command line application that authenticates users using LogonUser
. The function returns correctly and fails correctly (invalid user name or password). When I pass the token returned by the LogonUser
function into the WindowsIdentity(IntPtr)
constructor, I receive the error:
Invalid token for impersonation - it cannot be duplicated.
I've tried duplicating the token before passing it into the WindowsIdentity
constructor using the DuplicateToken
function. This fails as well. I have UAC on and am running Windows 7 x64. Running as both admin and not admin yields the same result.
Some additonal info:
- Logging into a domain
- Using
LOGON32_LOGON_INTERACTIVE
- Using
LOGON32_PROVIDER_DEFAULT
This ended up being environmental. DNS issue while attempting to authenticate against the domain. A reset of the development box fixed the issue.