HttpDigestClientCredential.AllowedImpersonationLevel Proprietà
Definizione
Importante
Alcune informazioni sono relative alla release non definitiva del prodotto, che potrebbe subire modifiche significative prima della release definitiva. Microsoft non riconosce alcuna garanzia, espressa o implicita, in merito alle informazioni qui fornite.
Ottiene o imposta il livello di rappresentazione consentito dal client con la credenziale client fornita.
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
Valore della proprietà
Enumerazione TokenImpersonationLevel concessa dal client al server come parte dell'autenticazione del digest HTTP.
Esempio
Nell'esempio seguente viene illustrato come impostare questa proprietà.
// Create a service host.
EndpointAddress ea = new EndpointAddress("http://localhost/Calculator");
WSHttpBinding b = new WSHttpBinding(SecurityMode.Transport);
b.Security.Transport.ClientCredentialType = HttpClientCredentialType.Digest;
// 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.
HttpDigestClientCredential digestCred = cc.ClientCredentials.HttpDigest;
Console.WriteLine("AllowedImpersonationLevel: {0}",
digestCred.AllowedImpersonationLevel);
Console.WriteLine("Domain: {0}", digestCred.ClientCredential.Domain);
Console.ReadLine();
// Change the AllowedImpersonationLevel.
digestCred.AllowedImpersonationLevel =
System.Security.Principal.TokenImpersonationLevel.Impersonation;
Console.WriteLine("Changed AllowedImpersonationLevel: {0}",
digestCred.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.Transport)
b.Security.Transport.ClientCredentialType = _
HttpClientCredentialType.Digest
' 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 digestCred As HttpDigestClientCredential = cc.ClientCredentials.HttpDigest
Console.WriteLine("AllowedImpersonationLevel: {0}", _
digestCred.AllowedImpersonationLevel)
Console.WriteLine("Domain: {0}", digestCred.ClientCredential.Domain)
Console.ReadLine()
' Change the AllowedImpersonationLevel.
digestCred.AllowedImpersonationLevel = _
System.Security.Principal.TokenImpersonationLevel.Impersonation
Console.WriteLine("Changed AllowedImpersonationLevel: {0}", _
digestCred.AllowedImpersonationLevel)
Console.ReadLine()
' Open the calculator and use it.
' cc.Open()
' Console.WriteLine(cc.Add(11, 11))
' Close the client.
' cc.Close()
Commenti
I valori consentiti includono:
A causa delle limitazioni dell'autenticazione digest, quando il client utilizza credenziali non predefinite, sono consentiti solo i livelli Impersonation
e Delegation
.