ClientFormsIdentity.AuthenticationType 속성

정의

사용자를 인증하는 데 사용되는 인증 형식을 가져옵니다.

public:
 property System::String ^ AuthenticationType { System::String ^ get(); };
public string AuthenticationType { get; }
member this.AuthenticationType : string
Public ReadOnly Property AuthenticationType As String

속성 값

사용자를 인증하는 데 사용되는 인증 형식입니다.

구현

예제

다음 예제 코드를 통해이 속성을 사용 하는 방법에 설명 된 IIdentity 클라이언트 애플리케이션 서비스에 대 한 현재 사용자가 인증 되었는지 여부를 확인 하기 위해 참조 합니다. 이 예제에서는 애플리케이션 기본 구성 사용자는 인증 쿠키가 만료 될 때 다시 로그인 할 필요가 있다고 가정 합니다. 그렇지 않은 경우는 WebException 사용자 로그인이 만료 되었음을 나타낼 수 있습니다.

private void SaveSettings()
{
    System.Security.Principal.IIdentity identity = 
        System.Threading.Thread.CurrentPrincipal.Identity;

    // Return if the user is not authenticated.
    if (identity == null || !identity.IsAuthenticated) return;

    // Return if the authentication type is not "ClientForms". 
    // This indicates that the user is not authenticated for 
    // client application services.
    if (!identity.AuthenticationType.Equals("ClientForms")) return;

    try
    {
        Properties.Settings.Default.Save();
    }
    catch (System.Net.WebException)
    {
        MessageBox.Show("Unable to access the Web settings service. " +
            "Settings were not saved on the remote service.", 
            "Not logged in", MessageBoxButtons.OK, MessageBoxIcon.Warning);
    }
}
Private Sub SaveSettings()

    Dim identity As System.Security.Principal.IIdentity = _
        System.Threading.Thread.CurrentPrincipal.Identity

    ' Return if the user is not authenticated.
    If identity Is Nothing OrElse Not identity.IsAuthenticated Then Return

    ' Return if the authentication type is not "ClientForms". This indicates
    ' that the user is not authenticated for client application services.
    If Not identity.AuthenticationType.Equals("ClientForms") Then Return

    Try

        My.Settings.Save()

    Catch ex As System.Net.WebException

        MessageBox.Show("Unable to access the Web settings service. " & _
            "Settings were not saved on the remote service.", _
            "Not logged in", MessageBoxButtons.OK, MessageBoxIcon.Warning)

    End Try

End Sub

설명

일반적으로 액세스 한 ClientFormsIdentity 개체는 IIdentity 이 클래스에 대 한 직접 종속성을 방지 하기 위해 참조 합니다. 확인 하 여 사용자가 인증 되었는지 여부를 확인할 수 있습니다는 IIdentity.IsAuthenticated id의 속성입니다. 그러나 클라이언트 애플리케이션 서비스 아니라, Windows에 대 한 사용자를 인증할 수 있습니다. 클라이언트 애플리케이션 서비스에 대 한 사용자가 인증 되었는지 여부를 확인 하려면도 확인 해야 하는 IIdentity.AuthenticationType 속성 값이 "ClientForms"입니다. 자세한 내용은 참조는 ClientFormsIdentity 클래스 개요입니다.

적용 대상

추가 정보