WindowsAuthenticationEventArgs.Identity 속성
정의
WindowsAuthenticationEventArgs 생성자에 전달된 Windows ID를 가져옵니다.Gets the Windows identity passed to the WindowsAuthenticationEventArgs constructor.
public:
property System::Security::Principal::WindowsIdentity ^ Identity { System::Security::Principal::WindowsIdentity ^ get(); };
public System.Security.Principal.WindowsIdentity Identity { get; }
member this.Identity : System.Security.Principal.WindowsIdentity
Public ReadOnly Property Identity As WindowsIdentity
속성 값
WindowsAuthenticationEventArgs 생성자에 전달된 Windows ID입니다.The Windows identity passed to the WindowsAuthenticationEventArgs constructor.
예제
다음 코드 예제에서는 합니다 WindowsAuthentication_OnAuthenticate 이벤트가 설정 합니다 User 속성이 현재 HttpContext 사용자 지정 IPrincipal 개체입니다.The following code example uses the WindowsAuthentication_OnAuthenticate event to set the User property of the current HttpContext to a custom IPrincipal object.
public void WindowsAuthentication_OnAuthenticate(object sender, WindowsAuthenticationEventArgs args)
{
if (!args.Identity.IsAnonymous)
{
args.User = new Samples.AspNet.Security.MyPrincipal(args.Identity);
}
}
Public Sub WindowsAuthentication_OnAuthenticate(sender As Object, args As WindowsAuthenticationEventArgs)
If Not args.Identity.IsAnonymous Then
args.User = New Samples.AspNet.Security.MyPrincipal(args.Identity)
End If
End Sub
설명
WindowsAuthenticationModule 생성을 WindowsAuthenticationEventArgs IIS와 현재 제공 하는 Windows id를 사용 하 여 개체 HttpContext 에 전달 합니다 WindowsAuthentication_OnAuthenticate 이벤트.The WindowsAuthenticationModule constructs a WindowsAuthenticationEventArgs object using the Windows identity supplied by IIS and the current HttpContext and passes it to the WindowsAuthentication_OnAuthenticate event.
IIS는 익명 인증을 사용 하는 경우는 Identity 속성에서 반환 된 id로 설정 되는 GetAnonymous 메서드.If IIS uses anonymous authentication, the Identity property is set to the identity returned by the GetAnonymous method.