WindowsClientCredential.AllowedImpersonationLevel Özellik

Tanım

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

public:
 property System::Security::Principal::TokenImpersonationLevel AllowedImpersonationLevel { System::Security::Principal::TokenImpersonationLevel get(); void set(System::Security::Principal::TokenImpersonationLevel value); };
public System.Security.Principal.TokenImpersonationLevel AllowedImpersonationLevel { get; set; }
member this.AllowedImpersonationLevel : System.Security.Principal.TokenImpersonationLevel with get, set
Public Property AllowedImpersonationLevel As TokenImpersonationLevel

Özellik Değeri

TokenImpersonationLevel

Değerlerden TokenImpersonationLevel biri.

Örnekler

Aşağıdaki örnekte bu özelliğin nasıl ayarlanacağı gösterilmektedir.

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

Bu özellik, Windows SSPI Negotiate kimlik doğrulaması kullanılırken istemci tarafından sunucuya verilen kimliğe bürünme düzeyini belirtir. İstemci belirtecinin kimliğine bürünen sunucu tarafından alınan kimliğe bürünme düzeyinin yalnızca bu ayarın bir işlevi olmadığını unutmayın. Ayrıca, hizmetin çalıştığı hesap için ilişkili ayrıcalıkların ve etki alanı ayarlarının bir işlevidir.

İstemcinin bu özelliği kullanarak izin verilen kimliğe bürünme düzeyini açıkça ayarlaması gerekir.

İstemci anonim kimliğe bürünme belirttiğinde, hizmette kimliğe bürünme gerçekleştirilmediğinde bile istemci her zaman hizmette anonim olarak kimlik doğrulaması yapar. Bunun nedeni, temel Windows işletim sistemi davranışıdır.

Windows kimliğe bürünme hakkında daha fazla bilgi için, Kimliğe Bürünme ve Geri Alma'ya gidin. Windows Communication Foundation kullanarak kimliğe bürünme hakkında daha fazla bilgi için bkz. Temsilci Seçme ve Kimliğe Bürünme.

Şunlara uygulanır