次の方法で共有


NegotiateStream.RemoteIdentity プロパティ

定義

この認証されたストリームを共有するリモート側の ID に関する情報を取得します。

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

プロパティ値

リモート エンドポイントの ID を示す IIdentity オブジェクト。

例外

認証に失敗したか、認証が行われていません。

次のコード例は、このプロパティの値を表示する方法を示しています。

private static void EndAuthenticateCallback(ClientState cState)
{
    // Get the saved data.
    NegotiateStream authStream = (NegotiateStream)cState.AuthenticatedStream;
    Console.WriteLine("Ending authentication.");

    // Display properties of the authenticated client.
    IIdentity id = authStream.RemoteIdentity;
    Console.WriteLine("{0} was authenticated using {1}.",
        id.Name,
        id.AuthenticationType
    );
}

注釈

クライアントからアクセスすると、このプロパティは、サーバーのサービス プリンシパル名 (SPN) と使用される認証プロトコルを含む を返 GenericIdentity します。 サーバーからアクセスされると、このプロパティはクライアントを記述する を WindowsIdentity 返します。 WindowsIdentityが使用できない場合は、 のGenericIdentityサーバーにクライアント情報が返されます。

適用対象