简体   繁体   English

来自 CreateChannelWithIssuedToken 的 WCF 通道仍在发送“requestsecuritytoken”请求

[英]WCF channel from CreateChannelWithIssuedToken still sending 'requestsecuritytoken' request

Using .Net 4.5 and generated a SAML2 token using WIF identity classes and trying to add it to the soap body request but its being ignored and soap request generated is actually has 'requestsecuritytoken' soap request which is going to the server.使用 .Net 4.5 并使用 WIF 身份类生成 SAML2 令牌并尝试将其添加到soap 正文请求中,但它被忽略并且生成的soap 请求实际上具有“requestsecuritytoken”soap 请求,该请求将发送到服务器。 I don't have any STS.我没有任何STS。

Reference code here ' Need signature after SAML token in client request ' seems working.此处的参考代码“ 在客户端请求中SAML 令牌后需要签名”似乎有效。

My custombinding in app.config is我在 app.config 中的自定义绑定是

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

And generated soap envelope is生成的肥皂信封是

    <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>

I want to test a secured web service with SAML we have in java from a .net client.我想使用来自 .net 客户端的 Java 中的 SAML 测试安全的 Web 服务。 I got the service client generated from WSDL in visual studio 2015 and then got the SAML assertion generated from classes and now trying pass that token with the soap request to the java service.我在 Visual Studio 2015 中获得了从 WSDL 生成的服务客户端,然后从类中获得了 SAML 断言,现在尝试将该令牌与soap请求一起传递给java服务。

Can some please share what I'm missing or doing wrong, I'm new to .net/WCF/WIF world?可以请一些人分享我遗漏或做错的事情,我是 .net/WCF/WIF 世界的新手吗?

thanks谢谢

After doing some more research, found out that the WCF infrastructure when having 'custombinding' at WCF client side generates a RST(requestsecuritytoken) request first in the background first and did not find yet if we can change that behavior.在做了更多的研究之后,发现 WCF 基础结构在 WCF 客户端具有“自定义绑定”时首先在后台首先生成一个 RST(requestsecuritytoken) 请求,并且还没有发现我们是否可以改变该行为。 So instead used 'basicHTTPBinding' with signature option (with protectlevel on client interface set to sign) which is now signing the soap body and putting timestamnp.因此,改为使用带有签名选项的“basicHTTPBinding”(客户端界面上的保护级别设置为签名),现在正在对soap主体进行签名并放置时间戳。
Now for SAML2 token insertion used interceptor and added it after generated it from WIF classes and send the final soap request which has SAML assertion signed, timestamp and soap body signed.现在对于 SAML2 令牌插入使用拦截器,并在从 WIF 类生成它后添加它,并发送具有 SAML 断言签名、时间戳和soap 正文签名的最终soap 请求。 The request was processed at Spring WS side with the security actions and business logic was invoked.请求在 Spring WS 端处理,安全操作和业务逻辑被调用。 This is is just for development and testing.这仅用于开发和测试。 I guess for Production we still needs to have a STS.我想对于生产我们仍然需要有一个 STS。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM