X509ClientCertificateAuthentication.IncludeWindowsGroups Property

Definition

Gets or sets a value that indicates whether Windows groups are included in the authorization context.

C#
public bool IncludeWindowsGroups { get; set; }

Property Value

true if Windows groups are included in the authorization context; otherwise, false. The default is true.

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 a certificate.
WSHttpBinding b = new WSHttpBinding(SecurityMode.Message);
b.Security.Message.ClientCredentialType =
    MessageCredentialType.Certificate;

// 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 includeWindowsGroups ='true'/>  
  </clientCertificate>  
</serviceCredentials>  

Remarks

This property is valid only when the MapClientCertificateToWindowsAccount property is set to true.

Set this property to false only if you do not need to establish the list of groups a user belongs to - this may result in a performance benefit if your application and authorization decisions do not require Windows groups.

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