Udostępnij za pośrednictwem


X509ClientCertificateAuthentication.CustomCertificateValidator Właściwość

Definicja

Pobiera lub ustawia niestandardowy moduł sprawdzania poprawności certyfikatu klienta.

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

Wartość właściwości

X509CertificateValidator

Niestandardowy moduł sprawdzania poprawności certyfikatu klienta.

Wyjątki

set gdy poświadczenie jest tylko do odczytu.

Przykłady

Poniższy kod pokazuje, jak ustawić tę właściwość.

// 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()

Właściwość można również ustawić w pliku konfiguracji.

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

Uwagi

CertificateValidationMode Jeśli właściwość jest ustawiona na Custom, należy ustawić CustomCertificateValidator właściwość na niestandardowy moduł sprawdzania poprawności, który dziedziczy po X509CertificateValidator klasie.

Aby uzyskać więcej informacji, zobacz How to: Create a Service that Employs a Custom Certificate Validator (Jak utworzyć usługę, która korzysta z niestandardowego modułu sprawdzania poprawności certyfikatu).

Dotyczy

Zobacz też