Share via


X509ClientCertificateAuthentication.CustomCertificateValidator プロパティ

定義

カスタム クライアント証明書検証を取得または設定します。

public:
 property System::IdentityModel::Selectors::X509CertificateValidator ^ CustomCertificateValidator { System::IdentityModel::Selectors::X509CertificateValidator ^ get(); void set(System::IdentityModel::Selectors::X509CertificateValidator ^ value); };
public System.IdentityModel.Selectors.X509CertificateValidator CustomCertificateValidator { get; set; }
member this.CustomCertificateValidator : System.IdentityModel.Selectors.X509CertificateValidator with get, set
Public Property CustomCertificateValidator As X509CertificateValidator

プロパティ値

カスタム クライアント証明書検証機能。

例外

資格情報が読み取り専用のとき set

次のコードに、このプロパティを設定する方法を示します。

// Create a service host.
Uri httpUri = new Uri("http://localhost/Calculator");
ServiceHost sh = new ServiceHost(typeof(Calculator), httpUri);

// Get a reference to the authentication object.
X509ClientCertificateAuthentication myAuthProperties =
    sh.Credentials.ClientCertificate.Authentication;

// Configure custom certificate validation.
myAuthProperties.CertificateValidationMode =
    X509CertificateValidationMode.Custom;
// Specify a custom certificate validator (not shown here) that inherits
// from the X509CertificateValidator class.
// creds.ClientCertificate.Authentication.CustomCertificateValidator =
//    new MyCertificateValidator();
' Create a service host.
Dim httpUri As New Uri("http://localhost/Calculator")
Dim sh As New ServiceHost(GetType(Calculator), httpUri)

' Get a reference to the authentication object.
Dim myAuthProperties As X509ClientCertificateAuthentication = _
sh.Credentials.ClientCertificate.Authentication

' Configure custom certificate validation.
myAuthProperties.CertificateValidationMode = X509CertificateValidationMode.Custom
' Specify a custom certificate validator (not shown here) that inherits 
' from the X509CertificateValidator class.
' creds.ClientCertificate.Authentication.CustomCertificateValidator = _
'    new MyCertificateValidator()

プロパティは構成ファイル内でも設定できます。

<serviceCredentials>  
  <clientCertificate>  
     <authentication certificateValidationMode='Custom' customCertificateValidatorType='Samples.MyCertificateValidator, Samples' />  
  </clientCertificate>  
</serviceCredentials>  

注釈

CertificateValidationMode プロパティが Custom に設定されている場合は、CustomCertificateValidator プロパティに X509CertificateValidator クラスから継承したカスタム検証を設定する必要があります。

詳細については、「方法: カスタム証明書検証を使用するサービスを作成する」を参照してください。

適用対象

こちらもご覧ください