<peerAuthentication> 元素

指定用于对等客户端的身份验证选项。

有关 对等编程的更多信息,请参见Peer to Peer Networking

<system.serviceModel>
  <behaviors>
    <endpointBehaviors>
      <endpointBehaviors> 的 <behavior>
        <clientCredentials>
          <clientCredentials> 的 <peer> 元素
            <peerAuthentication> 元素

<peerAuthentication
customCertificateValidatorType = "namespace.typeName, [,AssemblyName] [,Version=version number] [,Culture=culture] [,PublicKeyToken=token]"
certificateValidationMode = "ChainTrust/None/PeerTrust/PeerOrChainTrust/Custom"
revocationMode="NoCheck/Online/Offline"
trustedStoreLocation="CurrentUser/LocalMachine" 
/>

属性和元素

属性

属性 说明

customCertificateValidatorType

可选的字符串。用于验证自定义类型的类型和程序集。当 certificateValidationMode 设置为 Custom 时,必须设置此属性。

certifcateValidationMode

可选的枚举。指定用来验证凭据的三种模式之一。如果设置为 Custom,则还必须提供 customCertificateValidator。默认值为 ChainTrust

revocationMode

可选的枚举。用于检查吊销证书列表 (CRL) 的一种模式。默认值为 Online

trustedStoreLocation

可选的枚举。两个系统存储位置之一:LocalMachineCurrentUser。在向客户端协商服务证书时使用此值。将根据指定存储位置中的“受信任人”存储执行验证。默认值为 CurrentUser

子元素

无。

父元素

元素 说明

<clientCredentials> 的 <peer> 元素

指定一个用于向对等服务证明客户端身份的凭据。

备注

<authentication> 元素与 X509PeerCertificateAuthentication 类相对应。此元素指定一个验证程序,在网格中执行邻居对等身份验证的过程中将调用该验证程序。当新对等方尝试建立邻居连接时,它会将自己的凭据传递到响应的对等方。将调用响应方的验证程序来验证远程方的凭据。每当在网格中建立对等连接时,对等方将会相互进行身份验证,这意味着会同时在两方调用验证程序。

示例

下面的代码将证书验证模式设置为 PeerOrChainTrust

<behaviors>
 <endpointBehaviors>
  <behavior name="MyEndpointBehavior">
   <clientCredentials>
    <peer>
     <certificate findValue="www.contoso.com" 
                   storeLocation="LocalMachine"
                   x509FindType="FindByIssuerName" />
     <peerAuthentication 
          certificateValidationMode="PeerOrChainTrust" />
     <messageSenderAuthentication certificateValidationMode="None" />
    </peer>
   </clientCredentials>
  </behavior>
</endpointBehaviors>

另请参见

参考

PeerCredentialElement
X509PeerCertificateAuthentication
PeerAuthentication
PeerAuthentication
X509PeerCertificateAuthenticationElement

其他资源

Working with Certificates
Peer to Peer Networking
Peer Channel Message Authentication
Peer Channel Custom Authentication
Best Practices for Securing PeerChannel Applications