Freigeben über


WindowsClientCredential Klasse

Definition

Ermöglicht Ihnen das Angeben von Eigenschaften im Zusammenhang mit Windows-Anmeldeinformationen, die zum Darstellen des Clients verwendet werden sollen.

public ref class WindowsClientCredential sealed
public sealed class WindowsClientCredential
type WindowsClientCredential = class
Public NotInheritable Class WindowsClientCredential
Vererbung
WindowsClientCredential

Beispiele

Im folgenden Beispiel wird ein Client erstellt und ein Verweis auf die WindowsClientCredential. Der Code ändert dann den AllowedImpersonationLevel Wert in einen neuen Wert.

// Create a service host.
EndpointAddress ea = new EndpointAddress("http://localhost/Calculator");
WSHttpBinding b = new WSHttpBinding(SecurityMode.Message);
b.Security.Message.ClientCredentialType = MessageCredentialType.Windows;

// Create a client. The code is not shown here. See the WCF samples
// for an example of the CalculatorClient code.

CalculatorClient cc = new CalculatorClient(b, ea);
// Get a reference to the Windows client credential object.
WindowsClientCredential winCred= cc.ClientCredentials.Windows;
Console.WriteLine("AllowedImpersonationLevel: {0}",
    winCred.AllowedImpersonationLevel);
Console.WriteLine("AllowNtlm: {0}", winCred.AllowNtlm);
Console.WriteLine("Domain: {0}", winCred.ClientCredential.Domain);

Console.ReadLine();
// Change the AllowedImpersonationLevel.
winCred.AllowedImpersonationLevel =
    System.Security.Principal.TokenImpersonationLevel.Impersonation;

Console.WriteLine("Changed AllowedImpersonationLevel: {0}",
    winCred.AllowedImpersonationLevel);
Console.ReadLine();
// Open the calculator and use it.
//cc.Open();
//Console.WriteLine(cc.Add(11, 11));

//// Close the client.
//cc.Close();
' Create a service host.
Dim ea As New EndpointAddress("http://localhost/Calculator")
Dim b As New WSHttpBinding(SecurityMode.Message)
b.Security.Message.ClientCredentialType = _
MessageCredentialType.Windows

' Create a client. The code is not shown here. See the WCF samples
' for an example of the CalculatorClient code.
Dim cc As New CalculatorClient(b, ea)
' Get a reference to the Windows client credential object.
Dim winCred As WindowsClientCredential = cc.ClientCredentials.Windows
Console.WriteLine("AllowedImpersonationLevel: {0}", _
                 winCred.AllowedImpersonationLevel)
Console.WriteLine("AllowNtlm: {0}", winCred.AllowNtlm)
Console.WriteLine("Domain: {0}", winCred.ClientCredential.Domain)

Console.ReadLine()
' Change the AllowedImpersonationLevel.
winCred.AllowedImpersonationLevel = _
System.Security.Principal.TokenImpersonationLevel.Impersonation

Console.WriteLine("Changed AllowedImpersonationLevel: {0}", _
winCred.AllowedImpersonationLevel)
Console.ReadLine()
' Open the calculator and use it.
' cc.Open()
' Console.WriteLine(cc.Add(11, 11))
' Close the client.
' cc.Close()

Hinweise

Dies WindowsClientCredential ermöglicht die Einstellung von Windows-Clienteigenschaften, die bei der Kommunikation mit einem Dienst verwendet werden. The AllowedImpersonationLevel sets the level of impersonation the service can assume when imitating the client. Der ClientCredential Client ermöglicht es einem Client, sich mit Benutzername und Kennwort für den Dienst zu authentifizieren. Die AllowNtlm Bestimmt, ob NTLM zum Authentifizieren des Clients verwendet werden kann, wenn Kerberos nicht verwendet wird.

Eigenschaften

Name Beschreibung
AllowedImpersonationLevel

Dient zum Abrufen oder Festlegen der zulässigen Identitätswechselebene.

AllowNtlm
Veraltet.

Dient zum Abrufen oder Festlegen eines Werts, der angibt, ob die NTLM-Authentifizierung als Windows SSPI Negotiate-Authentifizierung zulässig sein soll.

ClientCredential

Ruft die Windows-Clientanmeldeinformationen ab oder legt sie fest.

Methoden

Name Beschreibung
Equals(Object)

Bestimmt, ob das angegebene Objekt dem aktuellen Objekt entspricht.

(Geerbt von Object)
GetHashCode()

Dient als Standardhashfunktion.

(Geerbt von Object)
GetType()

Ruft die Type der aktuellen Instanz ab.

(Geerbt von Object)
MemberwiseClone()

Erstellt eine flache Kopie der aktuellen Object.

(Geerbt von Object)
ToString()

Gibt eine Zeichenfolge zurück, die das aktuelle Objekt darstellt.

(Geerbt von Object)

Gilt für: