WindowsIdentity.GetCurrent 메서드

정의

현재 Windows 사용자를 나타내는 WindowsIdentity 개체를 반환합니다.

오버로드

GetCurrent(TokenAccessLevels)

지정한 희망 토큰 액세스 수준을 사용하여 현재 Windows 사용자를 나타내는 WindowsIdentity 개체를 반환합니다.

GetCurrent(Boolean)

ifImpersonating 매개 변수의 값에 따라 스레드나 프로세스에 대한 Windows ID를 나타내는 WindowsIdentity 개체를 반환합니다.

GetCurrent()

현재 Windows 사용자를 나타내는 WindowsIdentity 개체를 반환합니다.

GetCurrent(TokenAccessLevels)

지정한 희망 토큰 액세스 수준을 사용하여 현재 Windows 사용자를 나타내는 WindowsIdentity 개체를 반환합니다.

public:
 static System::Security::Principal::WindowsIdentity ^ GetCurrent(System::Security::Principal::TokenAccessLevels desiredAccess);
public static System.Security.Principal.WindowsIdentity GetCurrent (System.Security.Principal.TokenAccessLevels desiredAccess);
static member GetCurrent : System.Security.Principal.TokenAccessLevels -> System.Security.Principal.WindowsIdentity
Public Shared Function GetCurrent (desiredAccess As TokenAccessLevels) As WindowsIdentity

매개 변수

desiredAccess
TokenAccessLevels

열거형 값의 비트 조합입니다.

반환

WindowsIdentity

현재 사용자를 나타내는 개체입니다.

설명

desiredAccess매개 변수는 액세스 토큰에 대 한 요청 된 액세스 형식을 식별 하는 액세스 마스크를 지정 합니다. 이러한 요청 된 액세스 형식은 토큰의 DACL (임의 액세스 제어 목록)과 비교 하 여 부여 되거나 거부 되는 액세스 형식을 결정 합니다.

적용 대상

GetCurrent(Boolean)

ifImpersonating 매개 변수의 값에 따라 스레드나 프로세스에 대한 Windows ID를 나타내는 WindowsIdentity 개체를 반환합니다.

public:
 static System::Security::Principal::WindowsIdentity ^ GetCurrent(bool ifImpersonating);
public static System.Security.Principal.WindowsIdentity GetCurrent (bool ifImpersonating);
public static System.Security.Principal.WindowsIdentity? GetCurrent (bool ifImpersonating);
static member GetCurrent : bool -> System.Security.Principal.WindowsIdentity
Public Shared Function GetCurrent (ifImpersonating As Boolean) As WindowsIdentity

매개 변수

ifImpersonating
Boolean

스레드가 현재 가장하고 있는 경우에만 WindowsIdentity를 반환하려면 true이고, 스레드가 가장하고 있는 경우 스레드의 WindowsIdentity를 반환하거나 스레드가 현재 가장하고 있지 않은 경우 프로세스의 WindowsIdentity를 반환하려면 false입니다.

반환

WindowsIdentity

Windows 사용자를 나타내는 개체입니다.

설명

ifImpersonating가이 true 고 스레드가 가장 하지 않는 경우 반환 되는 WindowsIdentity 개체에는 값이 없습니다. ifImpersonating가이 false 고 스레드가 가장 하는 경우 WindowsIdentity 스레드에 대 한이 반환 됩니다. ifImpersonating가이 false 고 스레드가 가장 하지 않으면 WindowsIdentity 프로세스에 대 한이 반환 됩니다.

적용 대상

GetCurrent()

현재 Windows 사용자를 나타내는 WindowsIdentity 개체를 반환합니다.

public:
 static System::Security::Principal::WindowsIdentity ^ GetCurrent();
public static System.Security.Principal.WindowsIdentity GetCurrent ();
static member GetCurrent : unit -> System.Security.Principal.WindowsIdentity
Public Shared Function GetCurrent () As WindowsIdentity

반환

WindowsIdentity

현재 사용자를 나타내는 개체입니다.

예외

호출자에게 올바른 권한이 없습니다.

예제

다음 코드에서는 메서드를 사용하여 GetCurrent 현재 WindowsIdentity Windows 사용자를 나타내는 개체를 반환하는 방법을 보여줍니다. 이 코드 예제는에 대해 제공 된 큰 예제의 일부는 WindowsIdentity 클래스입니다.

IntPtr accountToken = WindowsIdentity::GetCurrent()->Token;
IntPtr accountToken = WindowsIdentity.GetCurrent().Token;
Console.WriteLine( "Token number is: " + accountToken.ToString());
Dim accountToken As IntPtr = WindowsIdentity.GetCurrent().Token

적용 대상