Udostępnij za pośrednictwem


ClientCredentials.Windows Właściwość

Definicja

Pobiera obiekt używany do kontrolowania poświadczeń systemu Windows używanych przez klienta do uwierzytelniania się w usłudze.

public:
 property System::ServiceModel::Security::WindowsClientCredential ^ Windows { System::ServiceModel::Security::WindowsClientCredential ^ get(); };
public System.ServiceModel.Security.WindowsClientCredential Windows { get; }
member this.Windows : System.ServiceModel.Security.WindowsClientCredential
Public ReadOnly Property Windows As WindowsClientCredential

Wartość właściwości

Element WindowsClientCredential reprezentujący bieżące poświadczenia systemu Windows.

Przykłady

Poniższy kod pokazuje, jak za pomocą obiektu zwróconego przez tę właściwość skonfigurować poziom personifikacji.

  // Create a client object with the given client endpoint configuration.
 CalculatorClient client = new CalculatorClient();
try
  {
      client.ClientCredentials.Windows.AllowedImpersonationLevel
          = TokenImpersonationLevel.Impersonation;
  }
  catch (TimeoutException timeProblem)
  {
    Console.WriteLine("The service operation timed out. " + timeProblem.Message);
    Console.ReadLine();
    client.Abort();
  }
  catch (CommunicationException commProblem)
  {
    Console.WriteLine("There was a communication problem. " + commProblem.Message + commProblem.StackTrace);
    Console.ReadLine();
    client.Abort();
  }
  ' Create a client object with the given client endpoint configuration.
 Dim client As New CalculatorClient()
Try
      client.ClientCredentials.Windows.AllowedImpersonationLevel = TokenImpersonationLevel.Impersonation
  Catch timeProblem As TimeoutException
    Console.WriteLine("The service operation timed out. " & timeProblem.Message)
    Console.ReadLine()
    client.Abort()
  Catch commProblem As CommunicationException
    Console.WriteLine("There was a communication problem. " & commProblem.Message + commProblem.StackTrace)
    Console.ReadLine()
    client.Abort()
  End Try

Uwagi

Za pomocą obiektu zwróconego przez tę właściwość można skonfigurować poświadczenia systemu Windows, wywołując jego elementy członkowskie, takie jak AllowNtlm i AllowedImpersonationLevel.

Te ustawienia kontrolują poświadczenia systemu Windows używane podczas negocjacji SPNEGO na poziomie komunikatu lub transportu lub właściwości tokenów Protokołu Kerberos używanych do uwierzytelniania na poziomie komunikatu.

Dotyczy