C# 클래스 LazyCopy.Utilities.Impersonator

Contains helper methods for user impersonation.
파일 보기 프로젝트 열기: aleksk/LazyCopy 1 사용 예제들

공개 메소드들

메소드 설명
Impersonate ( string domainUser ) : System.Security.Principal.WindowsImpersonationContext

Impersonates the specified user within the Explorer process context.
Explorer process is vital for the system and should always be there, if the user is logged in.

Impersonate ( string domainUser, Predicate processFilter ) : System.Security.Principal.WindowsImpersonationContext

Impersonates the specified user.

This method looks for the existing domainUser process running in the system, obtains and duplicates its token, and uses it to impersonate the caller. So it won't work, if the user is logged out or has no processes running.

비공개 메소드들

메소드 설명
DuplicateProcessHandle ( Process process ) : IntPtr

Duplicates handle for the process given.

메소드 상세

Impersonate() 공개 정적인 메소드

Impersonates the specified user within the Explorer process context.
Explorer process is vital for the system and should always be there, if the user is logged in.
is or empty. is not in the DOMAIN\username format. /// No processes are running for the . /// -or- /// Process handle cannot be duplicated. ///
public static Impersonate ( string domainUser ) : System.Security.Principal.WindowsImpersonationContext
domainUser string The domain user.
리턴 System.Security.Principal.WindowsImpersonationContext

Impersonate() 공개 정적인 메소드

Impersonates the specified user.
This method looks for the existing domainUser process running in the system, obtains and duplicates its token, and uses it to impersonate the caller. So it won't work, if the user is logged out or has no processes running.
is or empty. is not in the DOMAIN\username format. /// No processes are running for the . /// -or- /// Process handle cannot be duplicated. ///
public static Impersonate ( string domainUser, Predicate processFilter ) : System.Security.Principal.WindowsImpersonationContext
domainUser string The domain user.
processFilter Predicate Predicate to find the process suitable for impersonation. If it's , the first 's process will be used.
리턴 System.Security.Principal.WindowsImpersonationContext