gpt4 book ai didi

java - Apache CXF 将签名证书作为 BinarySecurityToken 添加到 WS-security header 中

转载 作者:搜寻专家 更新时间:2023-11-01 01:50:24 24 4
gpt4 key购买 nike

我正在使用 WSDL,我需要在发出 SOAP 请求时使用我的客户端证书签署时间戳和 SOAP 主体。

我的签名证书必须在消息中表示为 BinarySecurityToken,并像这样包含在 SOAP header 中:

<wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" soap:mustUnderstand="true">
<wsse:BinarySecurityToken EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary" ValueType="http://docs
.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3" wsu:Id="X509-15730854BE4465A46D14538884282111">MIIFO.......56Q==</wss
e:BinarySecurityToken>
<wsu:Timestamp wsu:Id="TS-1">
<wsu:Created>2016-03-16T09:53:48.201Z</wsu:Created>
<wsu:Expires>2016-03-16T09:58:48.201Z</wsu:Expires>
</wsu:Timestamp>
.......

我正在使用 WSS4JOutInterceptor 来自定义我的请求,但找不到将我的签名证书包含到请求中的方法:

// for outgoing messages: Signature and Timestamp validation
outProps.put(WSHandlerConstants.ACTION, WSHandlerConstants.SIGNATURE + " " + WSHandlerConstants.TIMESTAMP);
outProps.put(WSHandlerConstants.USER, "sss");
outProps.put(WSHandlerConstants.PW_CALLBACK_CLASS, ClientKeystorePasswordCallbackHandler.class.getName());
outProps.put(WSHandlerConstants.SIG_PROP_FILE, "client_sec.properties");
outProps.put(WSHandlerConstants.SIG_KEY_ID, "X509KeyIdentifier");
outProps.put(WSHandlerConstants.SIGNATURE_PARTS, "{}{http://schemas.xmlsoap.org/soap/envelope/}Body;{}{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd}Timestamp}");

有人可以建议我怎么做吗?

最佳答案

好的,这里作为要求的答案。 :-)

正如我在评论中提到的,您应该将 SIG_KEY_ID 的值更改为 outProps.put(WSHandlerConstants.SIG_KEY_ID, "DirectReference");

关于java - Apache CXF 将签名证书作为 BinarySecurityToken 添加到 WS-security header 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36031468/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com