WindowsClientCredential Sınıf

Tanım

İstemciyi temsil etmek için kullanılacak Windows kimlik bilgileriyle ilgili özellikleri belirtmenize olanak tanır.

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

Örnekler

Aşağıdaki örnek bir istemci oluşturur ve öğesine WindowsClientCredentialbaşvuru alır. Kod daha sonra öğesini yeni bir değerle AllowedImpersonationLevel değiştirir.

// 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()

Açıklamalar

, WindowsClientCredential bir hizmetle iletişim kurarken kullanılan Windows istemci özelliklerinin ayarlanmasını sağlar. , AllowedImpersonationLevel istemcinin kimliğine bürünme sırasında hizmetin varsayabileceği kimliğe bürünme düzeyini ayarlar. , ClientCredential bir istemcinin hizmette kullanıcı adı ve parola ile kimlik doğrulamasına olanak tanır. , AllowNtlm Kerberos kullanılmazsa istemcinin kimliğini doğrulamak için NTLM'nin kullanılıp kullanılamayacağını belirler.

Özellikler

AllowedImpersonationLevel

İzin verilen kimliğe bürünme düzeyini alır veya ayarlar.

AllowNtlm
Kullanımdan kalktı.

SSPI Anlaşma kimlik doğrulaması Windows NTLM kimlik doğrulamasına izin verilip verilmeyeceğini belirten bir değer alır veya ayarlar.

ClientCredential

Windows istemci kimlik bilgilerini alır veya ayarlar.

Yöntemler

Equals(Object)

Belirtilen nesnenin geçerli nesneye eşit olup olmadığını belirler.

(Devralındığı yer: Object)
GetHashCode()

Varsayılan karma işlevi işlevi görür.

(Devralındığı yer: Object)
GetType()

Type Geçerli örneğini alır.

(Devralındığı yer: Object)
MemberwiseClone()

Geçerli Objectöğesinin sığ bir kopyasını oluşturur.

(Devralındığı yer: Object)
ToString()

Geçerli nesneyi temsil eden dizeyi döndürür.

(Devralındığı yer: Object)

Şunlara uygulanır