提问人:Tony Rametta 提问时间:9/23/2023 更新时间:9/23/2023 访问量:19
使用 ws-security 创建 WCF 客户端请求,并在 C 中包含 Saml2Assertion#
Create a WCF Client request using ws-security and including a Saml2Assertion in C#
问:
我必须使用客户端证书调用 wcf 服务,并在 Security 标头中包含我预先构建的自定义 Saml2Assertion。SOAP 请求应如下所示:
<soap:Envelope>
<soap:Header>
<wsa:Action>
... ACTION ...
</wsa:Action>
<wsa:MessageID>47dca6bd-e36d-474a-9e92-3febdd0f123f</wsa:MessageID>
<wsa:To>....</wsa:To>
<Security xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<saml2:Assertion ID="_1d3708b9bba9b32904c0164a08d58a93" IssueInstant="2023-09-23T13:29:22.614Z" Version="2.0" xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion">
<saml2:Issuer>ISSUER</saml2:Issuer>
<ds:Signature>
<ds:SignedInfo>
<ds:CanonicalizationMethod ... />
<ds:SignatureMethod ... />
<ds:Reference URI="#_1d3708b9bba9b32904c0164a08d58a93">
<ds:Transforms>
<ds:Transform ... />
<ds:Transform ...>
<ec:InclusiveNamespaces PrefixList="xsd"
xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#"/>
</ds:Transform>
</ds:Transforms>
<ds:DigestMethod ... />
<ds:DigestValue>....</ds:DigestValue>
</ds:Reference>
</ds:SignedInfo>
</ds:Signature>
<saml2:AuthnStatement AuthnInstant="2023-09-23T13:29:22.614Z">
<saml2:AuthnContext>
<saml2:AuthnContextClassRef>
urn:oasis:names:tc:SAML:2.0:ac:classes:X509
</saml2:AuthnContextClassRef>
</saml2:AuthnContext>
</saml2:AuthnStatement>
<saml2:AttributeStatement>
<!-- Custom Attributes -->
<saml2:Attribute Name="CUSTOM_ATTRIBUTE_NAME" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri">
<saml2:AttributeValue xsi:type="xsd:string">
... CUSTOM ATTRIBUTE VALUE ...
</saml2:AttributeValue>
</saml2:Attribute>
</saml2:AttributeStatement>
</saml2:Assertion>
</Security>
</soap:Header>
<soap:Body>
... REQUEST ...
</soap:Body>
</soap:Envelope>
使用在链接文本中找到的解决方案没有帮助
任何帮助将不胜感激
答: 暂无答案
评论