C# Класс 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] ... } ...
Наследование: IDisposable
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
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.

Приватные методы

Метод Описание
UndoImpersonation ( ) : void

Stops impersonation.

Описание методов

Dispose() публичный Метод

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public Dispose ( ) : void
Результат void

Impersonate() публичный Метод

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.
Результат void

Impersonate() публичный Метод

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.
Результат void

Impersonator() публичный Метод

Initializes a new instance of the Impersonator class.
public Impersonator ( ) : System
Результат System

Impersonator() публичный Метод

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.
Результат System

Impersonator() публичный Метод

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.
Результат System