我获得了一些访问安全后端服务的文档,该服务假设消费者正在编写C#客户端。此服务需要使用X.509证书签名的部分。
虽然我理解这个概念,但我不确定如何将策略信息从C#转换为适合ESB的策略文档(我对ESB的例子是https://svn.wso2.org/repos/wso2/people/asela/ws-security/esb-endpoint-security/policy.xml)。
谷歌过去曾经问过我基本上同样的问题,但不幸的是,它指出的任何问题现在都给出了404错误,所以我希望这里有人能帮助我理解如何从C#转到WS-政策。C#的政策说明是:
<endpoint uri="http://server/path/InformationService.asmx">
<defaultOperation>
<request policy="#PolicyName" />
<response policy=""/>
<fault policy=""/>
</defaultOperation>
</endpoint>
<wssp:SecurityToken>
<wssp:TokenType>
http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3
</wssp:TokenType>
<wssp:TokenIssuer>
CN=Certificate IssuingeVendor
</wssp:TokenIssuer>
<wssp:Claims>
<wssp:SubjectName MatchType="wssp:Exact">
C=NZ, S=XX, L=XX, O=XX,
OU=XX, CN=XX, E=XX
</wssp:SubjectName>
<wssp:X509Extension OID="2.5.29.14" MatchType="wssp:Exact">
Jt67O6jYvOIdA2ffdZx6nI2NQBc=
</wssp:X509Extension>
</wssp:Claims>
</wssp:SecurityToken>
<wssp:MessageParts Dialect="http://schemas.xmlsoap.org/2002/12/wsse#part">
wsp:Body() wsp:Header(wsa:Action) wsp:Header(wsa:FaultTo) wsp:Header(wsa:From)
wsp:Header(wsa:MessageID) wsp:Header(wsa:RelatesTo) wsp:Header(wsa:ReplyTo)
wsp:Header(wsa:To) wse:Timestamp()
</wssp:MessageParts>
我已经将WSDL加载到ESB中,并且我认为我已经发现doco会覆盖它以使用证书(http://www.soasecurity.org/2012/11/how-to-invoke-secured-backend-service.html)所以只是这部分真的让我感到难过。
为清楚起见,最终游戏是:
{非安全的本地客户端} - &gt; {ESB} - &gt; {安全BE服务}
文档中给出的可能相关的其他信息 - 另一种非政策C#示例......
using Microsoft.Web.Services2;
using Microsoft.Web.Services2.Security;
using Microsoft.Web.Services2.Security.Tokens;
using Microsoft.Web.Services2.Security.X509;
[... class definition ...]
///<summary>
/// Applies the certificate to the specified proxy .
///</summary>
///<param name="proxy">The web service proxy to apply the signature to.</param>
///<param name="certificate">The certificate to use to sign the message parts.</param>
private static void ApplyCertificate(WebServicesClientProtocol proxy, X509Certificate certificate)
{
// get the current context
SoapContext requestContext = proxy.RequestSoapContext;
// create the token and signature
X509SecurityToken signatureToken = new X509SecurityToken(certificate);
requestContext.Security.Tokens.Add(signatureToken);
MessageSignature signature = new MessageSignature(signatureToken);
requestContext.Security.Elements.Add(signature);
// set the TTL of the message, prevents replay attacks
requestContext.Security.Timestamp.TtlInSeconds = 60;
}
非常感谢任何帮助或指示。
干杯, 丹尼尔