IClientFormsAuthenticationCredentialsProvider インターフェイス

定義

ユーザーの資格情報を取得するために、ClientFormsAuthenticationMembershipProvider クラスが呼び出すメソッドを定義します。

public interface class IClientFormsAuthenticationCredentialsProvider
public interface IClientFormsAuthenticationCredentialsProvider
type IClientFormsAuthenticationCredentialsProvider = interface
Public Interface IClientFormsAuthenticationCredentialsProvider

次のコード例は、 メソッドを実装する方法を 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 メソッドの実装では、ユーザー入力を取得するためのダイアログ ボックスが表示されます。 資格情報プロバイダーを使用することにより、複数のアプリケーション間で同じログイン ダイアログ ボックスを共有できます。

メソッド

GetCredentials()

ユーザー資格情報を取得します。

適用対象

こちらもご覧ください