WindowsClientCredential Kelas
Definisi
Penting
Beberapa informasi terkait produk prarilis yang dapat diubah secara signifikan sebelum dirilis. Microsoft tidak memberikan jaminan, tersirat maupun tersurat, sehubungan dengan informasi yang diberikan di sini.
Memungkinkan Anda menentukan properti yang terkait dengan kredensial Windows yang akan digunakan untuk mewakili klien.
public ref class WindowsClientCredential sealed
public sealed class WindowsClientCredential
type WindowsClientCredential = class
Public NotInheritable Class WindowsClientCredential
- Warisan
-
WindowsClientCredential
Contoh
Contoh berikut membuat klien dan mendapatkan referensi ke WindowsClientCredential. Kode kemudian mengubah ke AllowedImpersonationLevel nilai baru.
// 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()
Keterangan
WindowsClientCredential mengaktifkan pengaturan properti klien Windows yang digunakan saat berkomunikasi dengan layanan. AllowedImpersonationLevel mengatur tingkat peniruan yang dapat diasumsikan layanan saat meniru klien. ClientCredential memungkinkan klien untuk mengautentikasi dengan nama pengguna dan kata sandi ke layanan. AllowNtlm menentukan apakah NTLM dapat digunakan untuk mengautentikasi klien jika Kerberos tidak digunakan.
Properti
AllowedImpersonationLevel |
Mendapatkan atau mengatur tingkat peniruan yang diizinkan. |
AllowNtlm |
Kedaluwarsa.
Mendapatkan atau menetapkan nilai yang menunjukkan apakah autentikasi NTLM harus diizinkan sebagai Windows SSPI Negosiasi autentikasi. |
ClientCredential |
Mendapatkan atau mengatur kredensial klien Windows. |
Metode
Equals(Object) |
Menentukan apakah objek yang ditentukan sama dengan objek saat ini. (Diperoleh dari Object) |
GetHashCode() |
Berfungsi sebagai fungsi hash default. (Diperoleh dari Object) |
GetType() |
Mendapatkan dari instans Type saat ini. (Diperoleh dari Object) |
MemberwiseClone() |
Membuat salinan dangkal dari saat ini Object. (Diperoleh dari Object) |
ToString() |
Mengembalikan string yang mewakili objek saat ini. (Diperoleh dari Object) |