NegotiateStream.RemoteIdentity 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得共用此已驗證數據流之遠端合作物件身分識別的相關信息。
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)及所使用的認證協定。 當伺服器存取時,此屬性會回傳描述客戶端的 a WindowsIdentity 。 若無法取得,WindowsIdentity客戶端資訊會以 。GenericIdentity