C# Class projectBM.impersonate

Inheritance: IDisposable
Mostrar archivo Open project: zettasolutions/projectBM

Public Methods

Method Description
Dispose ( ) : void
impersonate ( ) : System
impersonate ( string domainName, string userName, string password ) : System

Constructor. Starts the impersonation with the given credentials. Please note that the account that instantiates the Impersonator class needs to have the 'Act as part of operating system' privilege set.

Private Methods

Method Description
CloseHandle ( IntPtr handle ) : bool
DuplicateToken ( IntPtr hToken, int impersonationLevel, IntPtr &hNewToken ) : int
ImpersonateValidUser ( string domain, string userName, string password ) : void

Does the actual impersonation.

LogonUser ( string lpszUserName, string lpszDomain, string lpszPassword, int dwLogonType, int dwLogonProvider, IntPtr &phToken ) : int
RevertToSelf ( ) : bool
UndoImpersonation ( ) : void

Reverts the impersonation.

Method Details

Dispose() public method

public Dispose ( ) : void
return void

impersonate() public method

public impersonate ( ) : System
return System

impersonate() public method

Constructor. Starts the impersonation with the given credentials. Please note that the account that instantiates the Impersonator class needs to have the 'Act as part of operating system' privilege set.
public impersonate ( string domainName, string userName, string password ) : System
domainName string The domain name of the user to act as.
userName string The name of the user to act as.
password string The password of the user to act as.
return System