WSFederationHttpSecurity.Mode Property

Definition

取得或設定要套用的安全性類型。Gets or sets the type of security to be applied.

public:
 property System::ServiceModel::WSFederationHttpSecurityMode Mode { System::ServiceModel::WSFederationHttpSecurityMode get(); void set(System::ServiceModel::WSFederationHttpSecurityMode value); };
public System.ServiceModel.WSFederationHttpSecurityMode Mode { get; set; }
member this.Mode : System.ServiceModel.WSFederationHttpSecurityMode with get, set
Public Property Mode As WSFederationHttpSecurityMode

Property Value

WSFederationHttpSecurityMode

WSFederationHttpSecurityModeA WSFederationHttpSecurityMode. 預設為 MessageThe default is Message.

Examples

下列程式碼將示範如何設定這個屬性。The following code shows how to set this property.

// This method creates a WSFederationHttpBinding.
public static WSFederationHttpBinding
    CreateWSFederationHttpBinding(bool isClient)
{
  // Create an instance of the WSFederationHttpBinding.
  WSFederationHttpBinding b = new WSFederationHttpBinding();

  // Set the security mode to Message.
  b.Security.Mode = WSFederationHttpSecurityMode.Message;
' This method creates a WSFederationHttpBinding.
Public Shared Function CreateWSFederationHttpBinding(ByVal isClient As Boolean) As WSFederationHttpBinding
  ' Create an instance of the WSFederationHttpBinding.
  Dim b As New WSFederationHttpBinding()

  ' Set the security mode to Message.
  b.Security.Mode = WSFederationHttpSecurityMode.Message

Remarks

傳回的列舉成員會指定要套用哪一種一般安全性類型。The enumeration member returned specifies which general type of security is to be applied.

允許的值有 MessageTransportWithMessageCredentialThe allowed values are Message and TransportWithMessageCredential.

Message 安全性模式中,訊息透過 HTTP 傳送,並使用 SOAP 訊息安全性來保護訊息。In the Message security mode, the message is sent over HTTP and SOAP message security is used to protect the message. 用戶端驗證會根據從安全性權杖服務所取得的權杖來執行。Client authentication is performed based on the issued token obtained from the security token service. 伺服器驗證則根據伺服器的憑證來執行。Server authentication is based on the server's certificate.

TransportWithMessageCredential 安全性模式中,訊息透過 HTTPS 傳送。In the TransportWithMessageCredential security mode, the message is sent over HTTPS. 用戶端驗證是以加入從 SOAP 訊息中安全性權杖服務所取得之權杖的方式來執行。Client authentication is performed by including the issued token obtained from the security token service in the SOAP message. 執行以伺服器憑證為基礎的伺服器驗證是 HTTPS 連線設定的一部分。Server authentication, based on the server's certificate, is performed as part of the HTTPS connection setup.

Applies to