来自 CreateChannelWithIssuedToken 的 WCF 通道仍在发送“requestsecurity

本文关键字:requestsecurity CreateChannelWithIssuedToken WCF 通道 来自 | 更新日期: 2024-10-25 15:29:22

使用 .Net 4.5 并使用 WIF 标识类生成了一个 SAML2 令牌,并尝试将其添加到 soap body 请求中,但它被忽略并且生成的 soap 请求实际上是具有"requestsecuritytoken"肥皂请求,该请求将进入服务器。我没有任何 STS。

此处的参考代码"在客户端请求中的 SAML 令牌后需要签名"似乎有效。

我在 app.config 中的自定义绑定是

        <customBinding>
          <binding name="AccountDetailsServiceSoap11" >
            <textMessageEncoding messageVersion="Soap11WSAddressing10"/>
            <security includeTimestamp="true">
            </security>
            <httpTransport></httpTransport>
          </binding>
   </customBinding>

生成的肥皂信封是

    <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" xmlns:a="http://www.w3.org/2005/08/addressing">
<s:Header>
<a:Action s:mustUnderstand="1">http://schemas.xmlsoap.org/ws/2005/02/trust/RST/Issue</a:Action><a:MessageID>urn:uuid:b7ff68ac-df62-4051-a68a-7382b0ec4995</a:MessageID><a:ReplyTo><a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address></a:ReplyTo><a:To s:mustUnderstand="1">http://localhost:8888/spring-webservices-sample/endpoints</a:To></s:Header><s:Body><t:RequestSecurityToken Context="uuid-f4007218-af5c-4f84-b800-0e47f102d3b5-1" xmlns:t="http://schemas.xmlsoap.org/ws/2005/02/trust"><t:TokenType>http://schemas.xmlsoap.org/ws/2005/02/sc/sct</t:TokenType><t:RequestType>http://schemas.xmlsoap.org/ws/2005/02/trust/Issue</t:RequestType><t:KeySize>256</t:KeySize><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">YHoGBisGAQUFAqBwMG6gMDAuBgorBgEEAYI3AgIKBgkqhkiC9xIBAgIGCSqGSIb3EgECAgYKKwYBBAGCNwICHqI6BDhOVExNU1NQAAEAAAC3shjiCQAJAC8AAAAHAAcAKAAAAAYBsR0AAAAPQUEzNzMwOUNJTkNPTVNZUw==</t:BinaryExchange></t:RequestSecurityToken></s:Body></s:Envelope>

我想用 SAML 测试一个安全的 Web 服务,我们在 java 中有一个 .net 客户端。我在Visual Studio 2015中获得了从WSDL生成的服务客户端,然后从类中获得了SAML断言,现在尝试将该令牌与soap请求传递给java服务。

有些人可以分享我错过或做错了什么,我是.net/WCF/WIF世界的新手吗?

谢谢

来自 CreateChannelWithIssuedToken 的 WCF 通道仍在发送“requestsecurity

在做了更多的研究之后,发现WCF基础结构在WCF客户端具有"自定义绑定"时首先在后台生成RST(requestsecuritytoken)请求,并且还没有发现我们是否可以更改该行为。因此,取而代之的是使用带有签名选项的"basicHTTPBinding"(客户端接口上的保护级别设置为签名),现在正在对肥皂体进行签名并放置 timetamnp。
现在,对于 SAML2 令牌插入,使用拦截器并在从 WIF 类生成它并发送具有 SAML 断言签名、时间戳和 SOAP 正文签名的最终 soap 请求后添加它。请求在 Spring WS 端处理,并执行安全操作并调用业务逻辑。 这仅用于开发和测试。我想对于生产,我们仍然需要一个 STS。

相关文章:
  • 没有找到相关文章