NegotiateStream.ImpersonationLevel プロパティ

定義

サーバーでクライアントの資格情報を使用する方法を示す値を取得します。Gets a value that indicates how the server can use the client's credentials.

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

プロパティ値

例外

認証に失敗したか、認証が行われていません。Authentication failed or has not occurred.

次のコード例は、このプロパティの値を表示する方法を示しています。The following code example demonstrates displaying the value of this property.

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);
}

注釈

このメソッドを呼び出す前に、を正常に認証する必要があります。You must successfully authenticate before calling this method. クライアントは、AuthenticateAsClient または BeginAuthenticateAsClient のいずれかのメソッドを呼び出すことによって認証を要求するときに、偽装レベルを指定します。Clients specify the impersonation level when they request authentication by calling one of the AuthenticateAsClient or BeginAuthenticateAsClient methods. TokenImpersonationLevel を指定せずに認証する場合は、Identification が使用されます。If you authenticate without specifying a TokenImpersonationLevel , Identification is used.

適用対象