WSFederationHttpSecurity.Mode 属性

定义

获取或设置要应用的安全类型。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

属性值

WSFederationHttpSecurityMode

WSFederationHttpSecurityModeA WSFederationHttpSecurityMode. 默认值为 MessageThe default is Message.

示例

下面的代码演示如何设置此属性。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

注解

返回的枚举成员指定要应用的常规安全类型。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.

适用于