ClientCredentials クラス

定義

クライアントとサービスの資格情報、および、クライアント側の通信で使用するサービス資格情報の認証設定をユーザーが構成できるようにします。

public ref class ClientCredentials : System::ServiceModel::Description::IEndpointBehavior
public ref class ClientCredentials : System::ServiceModel::Security::SecurityCredentialsManager, System::ServiceModel::Description::IEndpointBehavior
public class ClientCredentials : System.ServiceModel.Description.IEndpointBehavior
public class ClientCredentials : System.ServiceModel.Security.SecurityCredentialsManager, System.ServiceModel.Description.IEndpointBehavior
type ClientCredentials = class
    interface IEndpointBehavior
type ClientCredentials = class
    inherit SecurityCredentialsManager
    interface IEndpointBehavior
Public Class ClientCredentials
Implements IEndpointBehavior
Public Class ClientCredentials
Inherits SecurityCredentialsManager
Implements IEndpointBehavior
継承
ClientCredentials
継承
派生
実装

このクラスをオーバーライドし、カスタム セキュリティ トークン マネージャーを含む独自のカスタム クライアント資格情報を実装する方法を、次のコード例に示します。

重要

カスタム セキュリティ トークン マネージャーを作成するために、CreateSecurityTokenManager メソッドがオーバーライドされることに注意する必要があります。 ClientCredentialsSecurityTokenManager から派生したセキュリティ トークン マネージャーは、 実際のセキュリティ トークンを作成するために、SecurityTokenProvider から派生したカスタム セキュリティ トークン プロバイダーを返す必要があります。 このパターンに従ってセキュリティ トークンを作成しないと、アプリケーションがセキュリティ攻撃のリスク、特に権限の昇格のリスクにさらされます。 このコーディング パターンによって、チャネル ファクトリがキャッシュされるときに正しい資格情報が使用されるようになります。

public class MyClientCredentials : ClientCredentials
{
    string creditCardNumber;

    public MyClientCredentials()
    {
        // Perform client credentials initialization.
    }

    protected MyClientCredentials(MyClientCredentials other)
        : base(other)
    {
        // Clone fields defined in this class.
        this.creditCardNumber = other.creditCardNumber;
    }

    public string CreditCardNumber
    {
        get
        {
            return this.creditCardNumber;
        }
        set
        {
            if (value == null)
            {
                throw new ArgumentNullException("value");
            }
            this.creditCardNumber = value;
        }
    }

    public override SecurityTokenManager CreateSecurityTokenManager()
    {
        // Return your implementation of the SecurityTokenManager.
        return new MyClientCredentialsSecurityTokenManager(this);
    }

    protected override ClientCredentials CloneCore()
    {
        // Implement the cloning functionality.
        return new MyClientCredentials(this);
    }
}
Public Class MyClientCredentials
    Inherits ClientCredentials
    Private creditCardNumberValue As String

    Public Sub New() 
    
    End Sub
    
    ' Perform client credentials initialization.    
    Protected Sub New(ByVal other As MyClientCredentials) 
        MyBase.New(other)
        ' Clone fields defined in this class.
        Me.creditCardNumberValue = other.creditCardNumberValue
    
    End Sub

    Public Property CreditCardNumber() As String 
        Get
            Return Me.creditCardNumberValue
        End Get
        Set
            If value Is Nothing Then
                Throw New ArgumentNullException("value")
            End If
            Me.creditCardNumberValue = value
        End Set
    End Property

    Public Overrides Function CreateSecurityTokenManager() As SecurityTokenManager 
        ' Return your implementation of the SecurityTokenManager.
        Return New MyClientCredentialsSecurityTokenManager(Me)
    
    End Function
    
    Protected Overrides Function CloneCore() As ClientCredentials 
        ' Implement the cloning functionality.
        Return New MyClientCredentials(Me)
    
    End Function
End Class

注釈

ClientCredentials には、ClientCredentials クラスの ClientBase<TChannel> プロパティを使用してアクセスします。

ClientCredentials オブジェクトは、Behaviors コレクションに追加されます。 プロパティは ClientCredentials 、そのコレクション内のエントリに対する ファサード (よく知られているデザイン パターン) です。 このクラスのプロパティの多くは、主にプロパティで構成されるオブジェクトを返します。 これらのオブジェクトを、構成に使用できます。オブジェクトを get した後で、それを使用してそのメンバーを呼び出すことにより、プロパティを set できます。

コンストラクター

ClientCredentials()

ClientCredentials クラスの新しいインスタンスを初期化します。

ClientCredentials(ClientCredentials)

これはコピー コンストラクターです。

プロパティ

ClientCertificate

クライアントがサービスに対して自身を認証するために使用する X.509 証明書を提供するオブジェクトを取得します。

HttpDigest

現在の HTTP ダイジェスト資格情報を取得します。

IssuedToken

このプロパティを使用して、ローカル セキュリティ トークン サービスに接続するときに使用するエンドポイントのアドレスとバインディングを指定します。 この情報は、発行されたトークンを使用する認証がサービスで必要だが、発行されたトークンを取得する方法と場所が (クライアント上のバインディングとして表される) サービスのポリシーで明示的に指定されていない場合に使用されます。

Peer

ピア ノードがメッシュ内の他のノードに対して自身を認証するために使用する資格情報と、ピア ノードが他のピア ノードを認証するために使用する認証設定を制御します。

SecurityTokenHandlerCollectionManager

クライアント資格情報のセキュリティ トークン ハンドラーを取得または設定します。

ServiceCertificate

サービスの X.509 証明書を指定するために使用するオブジェクトを取得します。

SupportInteractive

必要に応じてシステムがユーザーに対話的に資格情報を要求できるようにするかどうかを示す値を取得または設定します。 たとえば、中間層シナリオでは false に設定する必要があります。

UseIdentityConfiguration

クライアント資格情報で identity 構成を使用するかどうかを取得または設定します。

UserName

クライアントがサービスに対して自身を認証するために使用するユーザー名とパスワードを設定するために使用する資格情報オブジェクトを取得します。

Windows

クライアントがサービスに対して自身を認証するために使用する Windows 資格情報の制御に使用されるオブジェクトを取得します。

メソッド

ApplyClientBehavior(ServiceEndpoint, ClientRuntime)

指定したクライアント動作をエンドポイントに適用します。

Clone()

この ClientCredentials インスタンスの新しいコピーを作成します。

CloneCore()

この ClientCredentials インスタンスの新しいコピーを作成します。

CreateSecurityTokenManager()

このインスタンスのセキュリティ トークン マネージャーを作成します。 このメソッドを明示的に呼び出すことはほとんどありません。このメソッドは主に拡張シナリオで使用され、システム自体によって呼び出されます。

Equals(Object)

指定されたオブジェクトが現在のオブジェクトと等しいかどうかを判断します。

(継承元 Object)
GetHashCode()

既定のハッシュ関数として機能します。

(継承元 Object)
GetInfoCardSecurityToken(Boolean, CardSpacePolicyElement[], SecurityTokenSerializer)

CardSpace システムと指定されたポリシー チェーンとトークン シリアライザーを使用して、セキュリティ トークンを生成して返します。

GetType()

現在のインスタンスの Type を取得します。

(継承元 Object)
MemberwiseClone()

現在の Object の簡易コピーを作成します。

(継承元 Object)
ToString()

現在のオブジェクトを表す文字列を返します。

(継承元 Object)

明示的なインターフェイスの実装

IEndpointBehavior.AddBindingParameters(ServiceEndpoint, BindingParameterCollection)

バインディング パラメーターのコレクションにこのクラスのこのインスタンスを追加します。

IEndpointBehavior.ApplyDispatchBehavior(ServiceEndpoint, EndpointDispatcher)

エンドポイント全体にわたってサービスの変更または拡張を実装します。

IEndpointBehavior.Validate(ServiceEndpoint)

将来使用するために予約されています。

適用対象