Share via


HttpTransportBindingElement.AuthenticationScheme Vlastnost

Definice

Získá nebo nastaví schéma ověřování používané k ověřování požadavků klientů zpracovávaných naslouchacím procesem HTTP.

public:
 property System::Net::AuthenticationSchemes AuthenticationScheme { System::Net::AuthenticationSchemes get(); void set(System::Net::AuthenticationSchemes value); };
public System.Net.AuthenticationSchemes AuthenticationScheme { get; set; }
member this.AuthenticationScheme : System.Net.AuthenticationSchemes with get, set
Public Property AuthenticationScheme As AuthenticationSchemes

Hodnota vlastnosti

Jedna z hodnot výčtu výčtu AuthenticationSchemes , která určuje protokoly používané pro ověřování klienta. Výchozí formát je Anonymous.

Výjimky

Hodnota pro AuthenticationSchemes hodnotu byla již nastavena.

Příklady

Následující příklad nastaví tuto vlastnost tak, aby se používala při ověřování požadavků klientů.

[ServiceContract]  
interface ICalculator  
{  
     [OperationContract]  
            Int Add(int a, int b);  
}  

HttpTransportBindingElement httpBinding = new HttpTransportBindingElement();  
httpBinding.AuthenticationScheme = AuthenticationSchemes.Digest;  
CustomBinding binding = new CustomBinding(new TextMessageEncodingBindingElement(), httpBinding);  

EndpointAddress endpoint = new EndpointAddress(address);  
ChannelFactory<ICalculator> proxy = new ChannelFactory<ICalculator>(binding, endpoint);  

proxy.Credentials.Windows.ClientCredential = new NetworkCredential("user", "password", "domain");  
proxy.Credentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation;  
proxy.Open();  

ICalculator calc = proxy.CreateChannel();  

int odd=calc.Add(5,4);  

Poznámky

Schéma ověřování lze nastavit pouze jednou.

Platí pro