Share via


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

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

반환

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

설명

매개 변수는 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입니다.

반환

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

설명

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

적용 대상

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

반환

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

예외

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

예제

다음 코드에서는 메서드를 GetCurrent 사용하여 현재 Windows 사용자를 나타내는 개체를 반환 WindowsIdentity 하는 방법을 보여 줍니다. 이 코드 예제는에 대해 제공 된 큰 예제의 일부는 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

적용 대상