X509ClientCertificateAuthentication.MapClientCertificateToWindowsAccount Property

Definition

Gets or sets a value that indicates whether the certificate is mapped to Windows accounts.

C#
public bool MapClientCertificateToWindowsAccount { get; set; }

Property Value

true if the certificate is mapped to Windows accounts; otherwise, false. The default is false.

Exceptions

set when credential is read-only.

Examples

The following code shows how to set this property.

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

// Create a binding that uses Windows security.
WSHttpBinding b = new WSHttpBinding(SecurityMode.Message);
b.Security.Message.ClientCredentialType = MessageCredentialType.Windows;

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

The property can also be set in a configuration file.

<serviceCredentials>  
  <clientCertificate>  
     <authentication mapClientCertificateToWindowsAccount='true'/>  
  </clientCertificate>  
</serviceCredentials>  

Remarks

When using the certificate client credential type on bindings, the certificate is not mapped to Windows accounts. You can override this behavior using this property. When this property is set to true, it causes the identity from the client certificate to be mapped to a Windows account.

Applies to

Product Versions
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1