C# Class YetAnotherRelogger.Helpers.Tools.Impersonator

Allows code to be executed under the security context of a specified user account.
Implements IDispose, so can be used via a using-directive or method calls; ... var imp = new Impersonator( "myUsername", "myDomainname", "myPassword" ); imp.UndoImpersonation(); ... var imp = new Impersonator(); imp.Impersonate("myUsername", "myDomainname", "myPassword"); imp.UndoImpersonation(); ... using ( new Impersonator( "myUsername", "myDomainname", "myPassword" ) ) { ... [code that executes under the new context] ... } ...
Inheritance: IDisposable
Afficher le fichier Open project: sinterlkaas/YetAnotherRelogger Class Usage Examples

Méthodes publiques

Méthode Description
Dispose ( ) : void

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

Impersonate ( string userName, string domainName, string password ) : void

Impersonates the specified user account.

Impersonate ( string userName, string domainName, string password, LogonType logonType, LogonProvider logonProvider ) : void

Impersonates the specified user account.

Impersonator ( ) : System

Initializes a new instance of the Impersonator class.

Impersonator ( string userName, string domainName, string password ) : System

Begins impersonation with the given credentials.

Impersonator ( string userName, string domainName, string password, LogonType logonType, LogonProvider logonProvider ) : System

Begins impersonation with the given credentials, Logon type and Logon provider.

Private Methods

Méthode Description
UndoImpersonation ( ) : void

Stops impersonation.

Method Details

Dispose() public méthode

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public Dispose ( ) : void
Résultat void

Impersonate() public méthode

Impersonates the specified user account.
public Impersonate ( string userName, string domainName, string password ) : void
userName string Name of the user.
domainName string Name of the domain.
password string The password.
Résultat void

Impersonate() public méthode

Impersonates the specified user account.
public Impersonate ( string userName, string domainName, string password, LogonType logonType, LogonProvider logonProvider ) : void
userName string Name of the user.
domainName string Name of the domain.
password string The password.
logonType LogonType Type of the logon.
logonProvider LogonProvider The logon provider.
Résultat void

Impersonator() public méthode

Initializes a new instance of the Impersonator class.
public Impersonator ( ) : System
Résultat System

Impersonator() public méthode

Begins impersonation with the given credentials.
public Impersonator ( string userName, string domainName, string password ) : System
userName string Name of the user.
domainName string Name of the domain.
password string The password.
Résultat System

Impersonator() public méthode

Begins impersonation with the given credentials, Logon type and Logon provider.
public Impersonator ( string userName, string domainName, string password, LogonType logonType, LogonProvider logonProvider ) : System
userName string Name of the user.
domainName string Name of the domain.
password string The password.
logonType LogonType Type of the logon.
logonProvider LogonProvider The logon provider.
Résultat System