共用方式為


NegotiateStream.RemoteIdentity 屬性

定義

取得共用這個經過驗證資料流之遠端群體識別的相關資訊。

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

屬性值

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

備註

用戶端存取時,這個屬性會傳回 , GenericIdentity 其中包含伺服器的服務主體名稱 (SPN) ,以及所使用的驗證通訊協定。 伺服器存取時,這個屬性會 WindowsIdentity 傳回描述用戶端的 。 WindowsIdentity如果 無法使用 ,用戶端資訊會傳回 至 中的GenericIdentity伺服器。

適用於