【问题标题】:WCF BasicHttpBinding + UserNamePasswordValidator+x.509WCF BasicHttpBinding + UserNamePasswordValidator+x.509
【发布时间】:2011-04-28 15:13:48
【问题描述】:

我使用带有自定义用户名验证 x.509 但没有 SSL 的 wsHttpBinding 为客户端设置了 WCF 服务

他们使用的是 PHP,完全无法通过 WS 安全,所以我们的解决方案必须是添加另一个基本的 httpbinding。但是当我这样做时,它似乎需要 SSL。我的要求是绝对不要使用 SSL。

我的 wshttpbinding 看起来像这样:

<wsHttpBinding>
    <binding name="WSHttpBinding_ISearchService" closeTimeout="00:10:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" bypassProxyOnLocal="true" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
      <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
      <reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false" />
      <security mode="Message"  >
        <message clientCredentialType="UserName"/>
      </security>
    </binding>

<serviceBehaviors>
    <behavior name="My.Services.SearchServiceBehavior">
      <serviceMetadata httpGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="true" />

      <dataContractSerializer maxItemsInObjectGraph="2147483647" />

      <serviceCredentials>
        <serviceCertificate findValue="01000000000xxxxxxxxx" storeLocation="LocalMachine"
                                 storeName="My" x509FindType="FindBySerialNumber" />
        <userNameAuthentication userNamePasswordValidationMode="Custom"
         customUserNamePasswordValidatorType="My.Services.UserNamePassValidator, SearchService" />
      </serviceCredentials>

    </behavior>
  </serviceBehaviors>

在没有 SSL 的情况下使用 basichttpbinding 是否可以实现相同的精确配置?

【问题讨论】:

    标签: wcf ssl basichttpbinding


    【解决方案1】:

    BasicHttpBinding 要求 BasicHttpBinding.Security.Message.ClientCredentialType 等效于安全模式“Message”的 BasicHttpMessageCredentialType.Certificate 凭据类型。所以首先你不能使用 clientCredentialType="UserName"。
    您需要有客户端证书来加密消息和传输。 WCF SDK 示例实现了这样一种场景,查看here

    【讨论】:

    • 如果我先设置证书类型,我可以使用用户名身份验证吗?问题是,我希望能够根据不同的凭据对多个客户端进行身份验证。我该怎么办,为每个客户创建不同的证书?
    • 这是 MSDN 关于 UserName auth 的说法“允许服务要求使用用户名凭据对客户端进行身份验证。请注意,WCF 不允许对用户名进行任何加密操作,例如生成签名或加密数据。WCF 确保在使用用户名凭据时传输是安全的。"
    猜你喜欢
    • 2012-10-24
    • 1970-01-01
    • 1970-01-01
    • 2012-07-14
    • 2014-05-30
    • 2011-07-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多