WindowsServiceCredential.IncludeWindowsGroups Eigenschaft

Definition

Ruft einen Wert ab, der angibt, ob die Windows-Gruppen, zu denen ein Client gehört, im Sicherheitskontext enthalten sind, oder legt diesen Wert fest.

public:
 property bool IncludeWindowsGroups { bool get(); void set(bool value); };
public bool IncludeWindowsGroups { get; set; }
member this.IncludeWindowsGroups : bool with get, set
Public Property IncludeWindowsGroups As Boolean

Eigenschaftswert

true, wenn Windows-Gruppen im Sicherheitskontext enthalten sind, andernfalls false. Der Standardwert ist true.

Beispiele

Der folgende Code zeigt, wie diese Eigenschaft abgerufen wird.

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

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

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

// Get a reference to the WindowsServiceCredential object.
WindowsServiceCredential winCredential =
    sh.Credentials.WindowsAuthentication;
// Print out values.
Console.WriteLine("IncludeWindowsGroup: {0}",
    winCredential.IncludeWindowsGroups);
Console.WriteLine("UserNamePasswordValidationMode: {0}",
    winCredential.AllowAnonymousLogons);

Console.ReadLine();
' Create a service host.
Dim httpUri As New Uri("http://localhost/Calculator")
Dim sh As New ServiceHost(GetType(Calculator), httpUri)

' Create a binding that uses a WindowsServiceCredential.
Dim b As New WSHttpBinding(SecurityMode.Message)
b.Security.Message.ClientCredentialType = MessageCredentialType.Windows

' Add an endpoint.
sh.AddServiceEndpoint(GetType(ICalculator), b, "WindowsCalculator")

' Get a reference to the WindowsServiceCredential object.
Dim winCredential As WindowsServiceCredential = sh.Credentials.WindowsAuthentication
' Print out values.
Console.WriteLine("IncludeWindowsGroup: {0}", winCredential.IncludeWindowsGroups)
Console.WriteLine("UserNamePasswordValidationMode: {0}", winCredential.AllowAnonymousLogons)

Console.ReadLine()

Hinweise

In den meisten Szenarios liefert die Kenntnis der Windows-Gruppen, denen Benutzer angehören, nützliche Informationen für Autorisierungsentscheidungen. Wenn die Windows-Gruppen jedoch nicht erforderlich sind, kann das Festlegen dieser Eigenschaft auf false dazu führen, dass die Leistung verbessert wird, da keine Auffüllung für die gesamte Gruppe durchgeführt werden muss.

Gilt für: