IClientFormsAuthenticationCredentialsProvider.GetCredentials 메서드

정의

사용자 자격 증명을 검색합니다.

public:
 System::Web::ClientServices::Providers::ClientFormsAuthenticationCredentials ^ GetCredentials();
public System.Web.ClientServices.Providers.ClientFormsAuthenticationCredentials GetCredentials();
abstract member GetCredentials : unit -> System.Web.ClientServices.Providers.ClientFormsAuthenticationCredentials
Public Function GetCredentials () As ClientFormsAuthenticationCredentials

반품

사용자 로그인 정보입니다.

예제

다음 예제 코드는 메서드를 구현하는 방법을 보여 줍니다 GetCredentials . 이 예제에서 GetCredentials 메서드는 로그인 대화 상자 클래스의 일부입니다. 이 메서드는 대화 상자를 표시한 다음 사용자가 지정한 ClientFormsAuthenticationCredentials 값으로 초기화된 인스턴스를 반환합니다.

public ClientFormsAuthenticationCredentials GetCredentials()
{
    if (this.ShowDialog() == DialogResult.OK)
    {
        return new ClientFormsAuthenticationCredentials(
            usernameTextBox.Text, passwordTextBox.Text,
            rememberMeCheckBox.Checked);
    }
    else
    {
        return null;
    }
}
Public Function GetCredentials() As  _
    ClientFormsAuthenticationCredentials Implements _
    IClientFormsAuthenticationCredentialsProvider.GetCredentials

    If Me.ShowDialog() = DialogResult.OK Then
        Return New ClientFormsAuthenticationCredentials( _
            UsernameTextBox.Text, PasswordTextBox.Text, _
            rememberMeCheckBox.Checked)
    Else
        Return Nothing
    End If

End Function

설명

클라이언트 애플리케이션 서비스에서 양식 인증을 사용하는 경우 사용자 이름과 암호를 메서드에 ValidateUser 전달할 수 있습니다. 또한 빈 문자열을 전달하거나 null 자격 증명 공급자를 사용하는 매개 변수로 전달할 수 있습니다. 자격 증명 공급자는 애플리케이션 구성에서 제공하고 지정하는 클래스입니다. 자격 증명 공급자 클래스는 단일 메서드가 있는 IClientFormsAuthenticationCredentialsProvider인터페이스를 구현 GetCredentials 해야 합니다. 일반적인 GetCredentials 메서드 구현은 사용자 입력을 검색하는 대화 상자를 표시합니다. 자격 증명 공급자를 사용하면 여러 애플리케이션 간에 단일 로그인 대화 상자를 공유할 수 있습니다.

적용 대상

추가 정보