This documentation is archived and is not being maintained.

UserNamePasswordServiceCredential.IncludeWindowsGroups Property

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

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

public bool IncludeWindowsGroups { get; set; }

Property Value

Type: System.Boolean
true if Windows groups are included in the security context; otherwise, false. The default is false.

In most scenarios when validating Windows user names and passwords, Windows groups in which users belong provide useful information for authorization decisions. However, if the Windows groups are not required, setting this property to false can improve performance by avoiding a full-group claim population.

The following example gets the value of this property.

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

// Create a binding that uses a username/password credential.
WSHttpBinding b = new WSHttpBinding(SecurityMode.Message);
b.Security.Message.ClientCredentialType = MessageCredentialType.UserName;

// Add an endpoint.
sh.AddServiceEndpoint(typeof(ICalculator), b, "UserNamePasswordCalculator");

// Get a reference to the UserNamePasswordServiceCredential object.
UserNamePasswordServiceCredential unpCredential = 
// Print out values.
Console.WriteLine("IncludeWindowsGroup: {0}", 
Console.WriteLine("UserNamePasswordValidationMode: {0}",
Console.WriteLine("CachedLogonTokenLifetime.Minutes: {0}",
    unpCredential.CachedLogonTokenLifetime.Minutes );
Console.WriteLine("CacheLogonTokens: {0}",
    unpCredential.CacheLogonTokens );
Console.WriteLine("MaxCachedLogonTokens: {0}",
    unpCredential.MaxCachedLogonTokens );


Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

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

.NET Framework

Supported in: 3.5, 3.0