<wsFederationHttpBinding>

定义支持 WS 联合身份验证的绑定。

<configuration>
  <system.serviceModel>
    <bindings>
      <wsFederationHttpBinding>

Syntax

<wsFederationHttpBinding>
  <binding bypassProxyOnLocal="Boolean"
           closeTimeout="TimeSpan"
           hostNameComparisonMode="StrongWildcard/Exact/WeakWildcard"
           maxBufferPoolSize="integer"
           maxReceivedMessageSize="integer"
           messageEncoding="Text/Mtom"
           name="string"
           openTimeout="TimeSpan"
           privacyNoticeAt="Uri"
           privacyNoticeVersion="Integer"
           proxyAddress="Uri"
           receiveTimeout="TimeSpan"
           sendTimeout="TimeSpan"
           textEncoding="UnicodeFffeTextEncoding/Utf16TextEncoding/ Utf8TextEncoding"
           transactionFlow="Boolean"
           useDefaultWebProxy="Boolean">
    <security mode="None/Message/TransportWithMessageCredential">
      <message algorithmSuite="Basic128/Basic192/Basic256/Basic128Rsa15/Basic256Rsa15/TripleDes/TripleDesRsa15/Basic128Sha256/Basic192Sha256/TripleDesSha256/Basic128Sha256Rsa15/Basic192Sha256Rsa15/Basic256Sha256Rsa15/TripleDesSha256Rsa15"
               issuedTokenType="string"
               issuedKeyType="SymmetricKey/PublicKey"
               negotiateServiceCredential="Boolean">
        <claimTypeRequirements>
          <add claimType="URI"
               isOptional="Boolean" />
        </claimTypeRequirements>
        <issuer address="Uri" >
          <headers>
            <add name="String"
                 namespace="String" />
          </headers>
          <identity>
            <certificate encodedValue="String" />
            <certificateReference findValue="String"
                                  isChainIncluded="Boolean"
                                  storeName="AddressBook/AuthRoot/CertificateAuthority/Disallowed/My/Root/TrustedPeople/TrustedPublisher"
                                  storeLocation="LocalMachine/CurrentUser"
                                  X509FindType="System.Security.Cryptography.X509certificates.X509findtype" />
            <dns value="String" />
            <rsa value="String" />
            <servicePrincipalName value="String" />
            <usePrincipalName value="String" />
          </identity>
        </issuer>
        <issuerMetadata address="String">
          <headers>
            <add name="String"
                 namespace="String" />
          </headers>
          <identity>
            <certificate encodedValue="String" />
            <certificateReference findValue="String"
                                  isChainIncluded="Boolean"
                                  storeName="AddressBook/AuthRoot/CertificateAuthority/Disallowed/My/Root/TrustedPeople/TrustedPublisher"
                                  storeLocation="LocalMachine/CurrentUser"
                                  x509FindType="System.Security.Cryptography.X509certificates.X509findtype" />
            <dns value="String" />
            <rsa value="String" />
            <servicePrincipalName value="String" />
            <usePrincipalName value="String" />
          </identity>
        </issuerMetadata>
        <tokenRequestParameters>
          <xmlElement>
          </xmlElement>
        </tokenRequestParameters>
      </message>
    </security>
    <reliableSession ordered="Boolean"
                     inactivityTimeout="TimeSpan"
                     enabled="Boolean" />
    <readerQuotas maxArrayLength="Integer"
                  maxBytesPerRead="Integer"
                  maxDepth="Integer"
                  maxNameTableCharCount="Integer"
                  maxStringContentLength="Integer" />
  </binding>
</wsFederationHttpBinding>

特性和元素

下列各节描述了特性、子元素和父元素。

特性

Attribute Description
bypassProxyOnLocal 一个布尔值,该值指示是否绕过本地地址的代理服务器。 默认值为 false
closeTimeout 一个 TimeSpan 值,该值指定为完成关闭作提供的时间间隔。 此值应大于或等于 Zero。 默认值为 00:01:00。
hostnameComparisonMode 指定用于分析 URI 的 HTTP 主机名比较模式。 此属性的类型 HostNameComparisonMode,指示主机名在 URI 上匹配时是否用于访问服务。 默认值为 StrongWildcard忽略匹配项中的主机名。
maxBufferPoolSize 一个整数,指定此绑定的最大缓冲池大小。 默认值为 524,288 字节(512 * 1024)。 Windows Communication Foundation(WCF)的许多部分都使用缓冲区。 每次使用缓冲区时创建和销毁缓冲区的成本高昂,缓冲区的垃圾回收也非常昂贵。 使用缓冲池,可以从池中获取缓冲区,使用它,并在完成后将其返回到池。 因此,可以避免创建和销毁缓冲区的开销。
maxReceivedMessageSize 一个正整数,指定可在配置有此绑定的通道上接收的最大消息大小(以字节为单位),包括标头。 超出此限制的消息发送方将收到 SOAP 错误。 接收方删除消息,并在跟踪日志中创建事件的条目。 默认值为 65536。
messageEncoding 定义用于对消息进行编码的编码器。 有效值包括:

- 文本:使用文本消息编码器。
- Mtom:使用消息传输组织机制 1.0 (MTOM) 编码器。

默认值为 Text。

此属性的类型 WSMessageEncoding为 .
姓名 一个字符串,其中包含绑定的配置名称。 此值应是唯一的,因为它用作绑定的标识。 从 .NET Framework 4 开始,不需要绑定和行为才能具有名称。 有关默认配置和无名称绑定和行为的详细信息,请参阅 WCF 服务的 简化配置简化配置
openTimeout 一个 TimeSpan 值,该值指定为打开作完成提供的时间间隔。 此值应大于或等于 Zero。 默认值为 00:01:00。
privacyNoticeAt 一个字符串,指定隐私声明所在的 URI。
privacyNoticeVersion 一个整数,指定当前隐私声明的版本。
proxyAddress 一个 URI,指定 HTTP 代理的地址。 useDefaultWebProxy如果是true,则此设置必须是 null。 默认值为 null
receiveTimeout 一个 TimeSpan 值,该值指定为接收作完成提供的时间间隔。 此值应大于或等于 Zero。 默认值为 00:10:00。
sendTimeout 一个 TimeSpan 值,该值指定为要完成的发送作提供的时间间隔。 此值应大于或等于 Zero。 默认值为 00:01:00。
textEncoding 设置用于在绑定上发出消息的字符集编码。 有效值包括:

- BigEndianUnicode:Unicode BigEndian 编码。
- Unicode:16 位编码。
- UTF8:8 位编码

默认值为 UTF8。 此属性的类型为 Encoding.。
transactionFlow 一个布尔值,该值指定绑定是否支持流动 WS-Transactions。 默认值为 false
useDefaultWebProxy 一个布尔值,该值指示是否使用了系统自动配置的 HTTP 代理。 如果此属性为 null,则代理地址必须为 true (即未设置)。 默认值为 true

子元素

元素 Description
<安全> 定义消息的安全设置。 此元素的类型 WSFederationHttpSecurityElement为 .
<readerQuotas> 定义由使用此绑定配置的终结点可以处理的 SOAP 消息复杂性的约束。 此元素的类型 XmlDictionaryReaderQuotasElement为 .
<ReliableSession> 指定是否在通道终结点之间建立可靠会话。

父元素

元素 Description
<绑定> 此元素包含标准绑定和自定义绑定的集合。

注解

联合身份验证是跨多个系统共享标识以进行身份验证和授权的功能。 这些标识可以引用用户或计算机。 联合 HTTP 支持 SOAP 安全性以及混合模式安全性,但它不支持独占使用传输安全性。 此绑定为 WS-Federation 协议提供 Windows Communication Foundation (WCF) 支持。 使用此绑定配置的服务必须使用 HTTP 传输。

绑定由绑定元素堆栈组成。 中的绑定元素堆栈

与包含在 中的 相同

<安全性> 设置为默认值时 Message

控制wsFederationHttpBinding邮件<中>邮件安全设置的详细信息。 请注意, <安全> 元素仅提供访问权限,因为创建绑定后无法更改绑定使用的安全性。

它还 wsFederationHttpBinding 提供 privacyNoticeAt 属性,用于设置和检索隐私声明所在的 URI。

在联合方案中,保持策略安全尤其重要。 建议使用某种形式的安全性(如 HTTPS)来保护策略免受恶意用户的攻击。

在使用此绑定的联合方案中,服务策略可能具有用于加密已颁发(SAML)令牌的密钥、要放入令牌中的声明类型等重要信息。 如果此策略被篡改,攻击者可能会发现颁发的令牌的密钥,从而导致进一步篡改、信息泄露和其他恶意行为。 为了帮助防止这种情况,必须安全地(例如使用 HTTPS)从服务获取策略。

有关此绑定的详细信息,请参阅 如何:创建 WSFederationHttpBinding

Example

<configuration>
  <system.ServiceModel>
    <bindings>
      <wsFederationHttpBinding>
        <binding bypassProxyOnLocal="false"
                 transactionFlow="false"
                 hostNameComparisonMode="WeakWildcard"
                 maxReceivedMessageSize="1000"
                 messageEncoding="Mtom"
                 proxyAddress="http://foo/bar"
                 textEncoding="Utf16TextEncoding"
                 useDefaultWebProxy="false">
          <reliableSession ordered="false"
                           inactivityTimeout="00:02:00"
                           enabled="true" />
          <security mode="None">
            <message negotiateServiceCredential="false"
                     algorithmSuite="Aes128"
                     issuedTokenType="saml"
                     issuedKeyType="PublicKey">
              <issuer address="http://localhost/Sts" />
            </message>
          </security>
        </binding>
      </wsFederationHttpBinding>
    </bindings>
  </system.ServiceModel>
</configuration>

另请参阅