Export (0) Print
Expand All

X509ClientCertificateAuthentication Class

Specifies authentication properties for validating the client certificate.

System.Object
  System.ServiceModel.Security.X509ClientCertificateAuthentication

Namespace:  System.ServiceModel.Security
Assembly:  System.ServiceModel (in System.ServiceModel.dll)

'Declaration
Public Class X509ClientCertificateAuthentication

The X509ClientCertificateAuthentication type exposes the following members.

  NameDescription
Public propertyCertificateValidationModeGets or sets the certificate validation mode.
Public propertyCustomCertificateValidatorGets or sets a custom client certificate validator.
Public propertyIncludeWindowsGroupsGets or sets a value that indicates whether Windows groups are included in the authorization context.
Public propertyMapClientCertificateToWindowsAccountGets or sets a value that indicates whether the certificate is mapped to Windows accounts.
Public propertyRevocationModeGets or sets the certificate revocation mode for ChainTrust and PeerOrChainTrust X.509 certificate validation.
Public propertyTrustedStoreLocationGets or sets the trusted store location under which context the client certificate chain is validated.
Top

  NameDescription
Public methodEquals(Object)Determines whether the specified object is equal to the current object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetHashCodeServes as the default hash function. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Top

If the CertificateValidationMode is set to Custom, then you must create a custom certificate validator that inherits from the X509CertificateValidator class. For more information, see How to: Create a Service that Employs a Custom Certificate Validator.

The following code shows how to set this property.

' 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 peer trust.
myAuthProperties.CertificateValidationMode = X509CertificateValidationMode.PeerTrust
' Configure chain trust.
myAuthProperties.CertificateValidationMode = X509CertificateValidationMode.ChainTrust
' 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()

The property can also be set in a configuration file.

<serviceCredentials>
  <clientCertificate>
     <authentication certificateValidationMode='ChainTrust' />
  </clientCertificate>
</serviceCredentials>

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show:
© 2014 Microsoft