由于服务提供商已对请求中的安全标头进行了一些更改,因此我正在更新现有SOAP Web服务的客户端。
要求是对时间戳进行数字签名,该时间戳应该出现在请求标头中,并且正文不应进行数字签名。我正在使用XML config创建我的SOAP请求标头,并对时间戳进行数字签名。
我基本上是使用org.springframework.ws.soap.security.wss4j.Wss4jSecurityInterceptor作为拦截器。问题是在请求标头中创建了时间戳,但是SignatureValue和DigestValue标记为空
我已推荐https://docs.spring.io/spring-ws/site/reference/html/security.html#security-wss4j-digital-signatures
版本:Spring-ws-core-> 2.0.0。发布spring-ws-security-> 2.0.0.RELEASE
<bean id="wsClientSecurityInterceptor" class="org.springframework.ws.soap.security.wss4j.Wss4jSecurityInterceptor">
<property name="securementActions" value="Timestamp Signature"/>
<property name="securementSignatureKeyIdentifier" value="DirectReference" />
<property name="securementUsername" value="username" />
<property name="securementPassword" value="keystorepassword" />
<property name="securementSignatureCrypto" ref="clientCrypto"/>
<property name="securementSignatureUser" value="username" />
<property name="securementSignatureParts" value="{}{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd}Timestamp"/>
</bean>
<bean id="clientCrypto" class="org.springframework.ws.soap.security.wss4j.support.CryptoFactoryBean">
<property name="keyStorePassword" value="keystorepassword" />
<property name="keyStoreLocation" value="file:${key.store.location}"/>
<property name="keyStoreType" value="jks" />
<property name="keyStoreProvider" value="IBMJCE" />
</bean>
尽管时间戳被添加到标题中的wsse:Security元素,但属于xmlns:ds =“ http://www.w3.org/2000/09/xmldsig#”命名空间的DigestValue和SignatureValue元素始终空
如果我只在身体上签名,这不会发生
我也尝试过使用另一个Interceptor XwsSecurityInterceptor,但是如果没有Wss4jSecurityInterceptor,该方法将不起作用,并且与Wss4jSecurityInterceptor一起使用时,会得到相同的结果。>
<bean id="xwsSecurityInterceptor" class="org.springframework.ws.soap.security.xwss.XwsSecurityInterceptor">
<property name="policyConfiguration" value="classpath:securityPolicy.xml"/>
<property name="callbackHandlers">
<list>
<ref bean="keyStoreHandler"/>
</list>
</property>
</bean>
<bean id="keyStoreHandler" class="org.springframework.ws.soap.security.xwss.callback.KeyStoreCallbackHandler">
<property name="keyStore" ref="keyStore"/>
<property name="privateKeyPassword" value="keystorepassword"/>
</bean>
<bean id="keyStore" class="org.springframework.ws.soap.security.support.KeyStoreFactoryBean">
<property name="location" value="file:${key.store.location}"/>
<property name="password" value="keystorepassword"/>
</bean>
我正在更新现有SOAP Web服务的客户端,因为服务提供者已对请求中的安全标头进行了一些更改。要求是对时间戳进行数字签名...
在参考了许多IBM支持文章之后,我终于来到了解决方案,并且也收到了有关实施的质量检查签字。我必须用WAS服务器本身上的配置替换所有的spring mvc配置来创建SSL上下文。您可以使用脚本或手动使用WAS控制台来配置所有这些。