使用WCF,IIS传输安全性以及客户端身份验证..是否可能?

时间:2013-04-18 03:36:52

标签: wcf ssl certificate iis-7.5

关于这一点,我可以在SO上找到几个类似的问题,但我对这个问题的答案我不太确定。当我阅读不同的帖子时,我变得越来越困惑。所以要求我满意。

我在IIS上托管了WCF服务。我有一个客户端连接到此服务并调用方法。我现在尝试使用证书来利用传输安全性。

在客户端,我有一个配置

<bindings>
  <basicHttpBinding>
    <binding name="testBinding">
      <security mode="Transport">
        <transport clientCredentialType="Certificate"  proxyCredentialType="Basic"/>
      </security>
    </binding>
  </basicHttpBinding>
</bindings>

<behaviors>
  <endpointBehaviors>
    <behavior name="testBehavior">
      <clientCredentials>
        <clientCertificate storeLocation="LocalMachine" storeName="My" x509FindType="FindBySubjectName" findValue="client007"/>
      </clientCredentials>
    </behavior>
  </endpointBehaviors>
</behaviors>

在服务器端,我有一个配置

<behaviors>
  <serviceBehaviors>
    <behavior name="testServiceBehavior">
      <serviceMetadata httpsGetEnabled="true"/>
      <serviceDebug includeExceptionDetailInFaults="true"/>
      <serviceCredentials>
        <clientCertificate>
          <authentication certificateValidationMode="PeerTrust" trustedStoreLocation="LocalMachine"/>
        </clientCertificate>
      </serviceCredentials>
    </behavior>
  </serviceBehaviors>
</behaviors>

<bindings>
  <basicHttpBinding>
    <binding name="testServiceBinding">
      <security mode="Transport">
        <transport clientCredentialType="Certificate"/>
      </security>
    </binding>
  </basicHttpBinding>
</bindings>

现在,我想要的场景是,只有在服务器的受信任人员上安装了公钥的客户端才能访问该服务。

但就我而言,我是否在受信任的人中安装了公钥。我可以使用我自己创建的任何证书来访问该服务。

我检查了匿名身份验证是否已启用,是不是因为这个?当我禁用匿名访问时,我收到一条错误

  

http请求未经授权,客户端身份验证从服务器收到的身份验证是基本领域

如何确保只有服务器上公钥的客户端才能访问该服务?

此类验证不适用于传输安全性吗?请帮我。感谢

0 个答案:

没有答案