如何使 wss4j 不在肥皂头中创建过期元素

发布于 2024-12-22 01:13:58 字数 669 浏览 3 评论 0原文

wss4j 或 cxf 中是否有任何选项可以控制 ws-security 中的 元素是否包含在 SOAP 标头中。

我想要实现的是 SOAP 标头仅包含 元素,例如

<wsu:Timestamp wsu:Id="Timestamp-2" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
    <wsu:Created>2011-12-07T14:39:03Z</wsu:Created>
</wsu:Timestamp>

我正在使用 wss4j 1.5.10 和 cxf 2.3.x

请注意 xsd 架构 时间戳有

<xsd:element ref="wsu:Expires" minOccurs="0"/>

Is there any option in wss4j or cxf that controls whether <expires> element from ws-security is included in SOAP header.

What I want to achieve is that SOAP header contains only <created> element, e.g.

<wsu:Timestamp wsu:Id="Timestamp-2" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
    <wsu:Created>2011-12-07T14:39:03Z</wsu:Created>
</wsu:Timestamp>

I'm using wss4j 1.5.10 and cxf 2.3.x

Note that xsd schema for timestamp has

<xsd:element ref="wsu:Expires" minOccurs="0"/>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

葬心 2024-12-29 01:13:58

我需要同样的东西,但无法在任何地方找到答案。
最后,我研究了源代码,并扩展了 WSS4JOutInterceptor 并以这种方式重写了 decodeTimeToLive 方法:

@Override
public int decodeTimeToLive(RequestData reqData) {
     return 0;
}

也许不美观,但它对我有用。

I needed the same thing and wasn't able to find an answer anywhere.
At the end I studied the source and did it extending the WSS4JOutInterceptor and rewriting the method decodeTimeToLive this way:

@Override
public int decodeTimeToLive(RequestData reqData) {
     return 0;
}

Maybe not beautiful, but it worked for me.

孤独陪着我 2024-12-29 01:13:58

我认为您将 timeToLive 设置为一个较小的值创建将等于过期并且不会添加过期信息

I think that of you set timeToLive to a small value created will be equal to expire and the expires info is not added

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文