public override WindowsIdentity GetWindowsIdentity() { if (!LogonUserIdentityProvider.LogonUser(this._credential.UserName, this._credential.Domain, this._credential.Password, 3, 0, out LogonUserIdentityProvider._token)) { int lastWin32Error = Marshal.GetLastWin32Error(); string logonUserIdentityProviderLogonUserErrorTemplate = Exceptions.LogonUserIdentityProvider_LogonUserErrorTemplate; string[] str = new string[] { lastWin32Error.ToString(CultureInfo.InvariantCulture), this._credential.ToString() }; ExceptionHelper.Throw <InvalidOperationException>(logonUserIdentityProviderLogonUserErrorTemplate, str); } return(new WindowsIdentity(LogonUserIdentityProvider._token)); }
public override void Dispose() { base.Dispose(); LogonUserIdentityProvider.CloseHandle(LogonUserIdentityProvider._token); }