c# - WCF:CustomBinding 混淆端点

标签 c# wcf security endpoint

我正在使用 CustomBinding 启用 Soap 1.1(端点不支持 1.2)+ Addressing 1.0。端点仅可通过 SSL 使用,并在某种 Java/Weblogic 平台上运行。

这是我的配置:

<customBinding>
    <binding name="Soap11Addr10">
        <textMessageEncoding messageVersion="Soap11WSAddressing10" />
        <httpsTransport/>
    </binding>
</customBinding>

[...]

<endpoint address="https://sekrit:444/more-sekrits/even-more"
    binding="customBinding" bindingConfiguration="Soap11Addr10"
    contract="SomePort" name="SomePortService" />

这个配置似乎混淆了端点。当我对 SomePort 执行请求时,WCF 首先发送 RequestSecurityTokenResponse 消息,我认为这可能是不幸的。这是 RSTR 信封的踪迹:

<s:Envelope xmlns:a="http://www.w3.org/2005/08/addressing" xmlns:s="http://www.w3.org/2003/05/soap-envelope">
  <s:Header>
    <a:Action s:mustUnderstand="1">http://schemas.xmlsoap.org/ws/2005/02/trust/RSTR/Issue</a:Action>
    <a:RelatesTo>urn:uuid:7348d908-b767-43e8-9770-09a38461ee87</a:RelatesTo>
  </s:Header>
  <s:Body>
    <t:RequestSecurityTokenResponse Context="uuid-7a3c9fde-053d-46e7-aa08-f5725b082691-287" xmlns:t="http://schemas.xmlsoap.org/ws/2005/02/trust" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
      <t:BinaryExchange ValueType="http://schemas.xmlsoap.org/ws/2005/02/trust/spnego" EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">TlRMTVNTUAACAAAAEAAQADgAAAA1wpriPjzjL4iwIJhAmcsBAAAAAGAAYABIAAAABgByFwAAAA9TAEsATwBHAEsAQQBUAFQAAgAQAFMASwBPAEcASwBBAFQAVAABABAAUwBLAE8ARwBLAEEAVABUAAQAEABTAGsAbwBnAGsAYQB0AHQAAwAQAFMAawBvAGcAawBhAHQAdAAHAAgAj73D884kywEAAAAA</t:BinaryExchange>
    </t:RequestSecurityTokenResponse>
  </s:Body>
</s:Envelope>

端点 barfs:

<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
  <env:Header></env:Header>
  <env:Body>
    <env:Fault xmlns:ns0="http://schemas.xmlsoap.org/soap/envelope/">
      <faultcode xmlns="">ns0:MustUnderstand</faultcode>
      <faultstring xml:lang="en" xmlns="">One or more mandatory SOAP header blocks not understood</faultstring>
    </env:Fault>
  </env:Body>
</env:Envelope>

是否可以停止发送初始 RSTR?

我可以根据要求提供更多跟踪和日志数据。

最佳答案

在不了解有关目标服务的更多信息的情况下,很难说出它的期望,但我猜想 WCF 使用的是消息安全性,这意味着每条消息都是单独加密的。您可能只想要传输级别的安全性(即 https)。

您可以尝试设置 <security mode="Transport" />在绑定(bind)配置中。

关于c# - WCF:CustomBinding 混淆端点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3263916/

相关文章:

security - Struts2 + 类加载器漏洞 + 如何重现

c# - 使用 iTextSharp 将图像插入 PDF

c# - Code First - 自引用一对多关系

c# - WCF:设置了FaultContract,但未导致REST 服务中捕获FaultException<T>

asp.net - WCF 服务调用返回空文件/页面

asp.net - JSON 安全

c# - 错误单元测试 webapi Controller

c# - 如何在 WPF 中仅在左侧和右侧指定矩形描边?

wcf - 为什么我的 WCF 服务不响应 web.config 中的 baseAddress 设置?

java - 堆栈跟踪和错误中的密码清理