【问题标题】:Writing WCF interceptor for WCF WS-Security and WSE Nonce Authentication为 WCF WS-Security 和 WSE Nonce 身份验证编写 WCF 拦截器
【发布时间】:2013-02-22 20:10:01
【问题描述】:

我必须编写一个 WCF 拦截器来扩展 WCF 行为

我的扩展程序的行为是它会在请求中添加一个自定义标头......

自定义标题如下所示

  <soapenv:Header>
    <wsse:Security soapenv:mustUnderstand="1"
  xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<wsse:UsernameToken wsu:Id="UsernameToken-8"
  xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
  <wsse:Username>TeStUsErNaMe1</wsse:Username>
  <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText"                  >TeStPaSsWoRd1</wsse:Password>
  <wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary"                  >f8nUe3YupTU5ISdCy3X9Gg==</wsse:Nonce>
  <wsu:Created>2011-05-04T19:01:40.981Z</wsu:Created>
</wsse:UsernameToken>
</wsse:Security>

我已经编写了一个 CustomCredential,它将向请求添加标头。

我的问题是如何扩展这个 WCF 行为

因为它正在使用 CustomCredentials

我想要类似下面的东西

client.ChannelFactory.Endpoint.Behaviors.Remove(); client.ChannelFactory.Endpoint.Behaviors.Add(new CustomCredentials());

在我的 WCF 拦截器中

【问题讨论】:

    标签: wcf wcf-data-services wcf-binding wcf-security


    【解决方案1】:

    这是一篇关于如何做到这一点的好文章。它详细解释了它,并且在需要 Nonce 和 Created 的 WS-Security Web 服务上表现出色。

    http://www.west-wind.com/weblog/posts/2012/Nov/24/WCF-WSSecurity-and-WSE-Nonce-Authentication

    【讨论】:

      猜你喜欢
      • 2017-06-15
      • 2011-04-07
      • 2015-10-20
      • 1970-01-01
      • 1970-01-01
      • 2011-08-18
      相关资源
      最近更新 更多