gpt4 book ai didi

java - 错误: Username Token Created policy not enforced

转载 作者:太空宇宙 更新时间:2023-11-04 12:41:59 25 4
gpt4 key购买 nike

我正在开发基于 CXF 的服务和客户端。并使用 wsdl 中定义的策略文件在服务器端实现用户名密码安全。这是配置:

<wsp:Policy wsu:Id="policy.Security" xmlns:wsp="http://www.w3.org/ns/ws-policy">
<wsp:ExactlyOne>
<wsp:All>
<sp:SupportingTokens>
<wsp:Policy>
<sp:UsernameToken
sp:IncludeToken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/AlwaysToRecipient"
wsp:Optional="false" wsp:Ignorable="false">
<wsp:Policy>
<sp:WssUsernameToken10 />
<sp13:Created />
<sp13:Nonce />
</wsp:Policy>
</sp:UsernameToken>
</wsp:Policy>
</sp:SupportingTokens>
</wsp:All>
</wsp:ExactlyOne>
</wsp:Policy>

客户端配置:

<jaxws:client
xmlns:tns="http://ws.soa.com/service/offer/XYZ/"
name="XYZPort" address="${xyz.endPoint}"
serviceClass="com.soa.ws.service.offer.XYZ.XYZPortType"
wsdlLocation="${xyz.wsdlLocation}" serviceName="tns:xyzService" >
<jaxws:properties>
<entry key="ws-security.username" value="${xyz.auth.username}" />
<entry key="ws-security.callback-handler" value-ref="xyzPasswordCallback" />
</jaxws:properties>
<jaxws:inInterceptors>
<ref bean="logInBound" />
</jaxws:inInterceptors>
<jaxws:outInterceptors>
<ref bean="logOutBound" />
</jaxws:outInterceptors>
</jaxws:client>

尝试访问服务时收到以下错误:

由以下原因引起:javax.xml.ws.soap.SOAPFaultException:无法满足这些策略替代方案:{ http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702 }UsernameToken:用户名 token 创建策略未强制执行 在 org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:157)

任何人都可以指导如何解决这个问题吗?

最佳答案

您可能使用的是旧版本的 CXF。此问题已修复:

https://issues.apache.org/jira/browse/CXF-6051

关于java - 错误: Username Token Created policy not enforced,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36752905/

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