Bagikan melalui


NegotiateStream.ImpersonationLevel Properti

Definisi

Mendapatkan nilai yang menunjukkan bagaimana server dapat menggunakan kredensial klien.

public:
 virtual property System::Security::Principal::TokenImpersonationLevel ImpersonationLevel { System::Security::Principal::TokenImpersonationLevel get(); };
public virtual System.Security.Principal.TokenImpersonationLevel ImpersonationLevel { get; }
member this.ImpersonationLevel : System.Security.Principal.TokenImpersonationLevel
Public Overridable ReadOnly Property ImpersonationLevel As TokenImpersonationLevel

Nilai Properti

Salah TokenImpersonationLevel satu nilai.

Pengecualian

Autentikasi gagal atau belum terjadi.

Contoh

Contoh kode berikut menunjukkan menampilkan nilai properti ini.

static void DisplayAuthenticationProperties( NegotiateStream^ stream )
{
   Console::WriteLine( L"IsAuthenticated: {0}", stream->IsAuthenticated );
   Console::WriteLine( L"IsMutuallyAuthenticated: {0}", stream->IsMutuallyAuthenticated );
   Console::WriteLine( L"IsEncrypted: {0}", stream->IsEncrypted );
   Console::WriteLine( L"IsSigned: {0}", stream->IsSigned );
   Console::WriteLine( L"ImpersonationLevel: {0}", stream->ImpersonationLevel );
   Console::WriteLine( L"IsServer: {0}", stream->IsServer );
}


 static void DisplayAuthenticationProperties(NegotiateStream stream)
{
     Console.WriteLine("IsAuthenticated: {0}", stream.IsAuthenticated);
    Console.WriteLine("IsMutuallyAuthenticated: {0}", stream.IsMutuallyAuthenticated);
    Console.WriteLine("IsEncrypted: {0}", stream.IsEncrypted);
    Console.WriteLine("IsSigned: {0}", stream.IsSigned);
    Console.WriteLine("ImpersonationLevel: {0}", stream.ImpersonationLevel);
    Console.WriteLine("IsServer: {0}", stream.IsServer);
}

Keterangan

Anda harus berhasil mengautentikasi sebelum memanggil metode ini. Klien menentukan tingkat peniruan ketika mereka meminta autentikasi dengan memanggil salah AuthenticateAsClient satu metode atau BeginAuthenticateAsClient . Jika Anda mengautentikasi tanpa menentukan TokenImpersonationLevel , Identification digunakan.

Berlaku untuk