Spring integration 如何将ws-security用户名输入到Spring集成消息头中
我对Spring集成相当陌生。如何将ws-security用户名令牌放入Spring集成头中。我知道如何添加Wss4jSecurityInterceptor来验证用户名,但由于这是一个拦截器,我无法访问mMessage对象。一旦消息被解组为JAB对象,我就失去了对SOAP头的引用Spring integration 如何将ws-security用户名输入到Spring集成消息头中,spring-integration,Spring Integration,我对Spring集成相当陌生。如何将ws-security用户名令牌放入Spring集成头中。我知道如何添加Wss4jSecurityInterceptor来验证用户名,但由于这是一个拦截器,我无法访问mMessage对象。一旦消息被解组为JAB对象,我就失去了对SOAP头的引用 <bean class="org.springframework.ws.server.endpoint.mapping.UriEndpointMapping"> <pr
<bean
class="org.springframework.ws.server.endpoint.mapping.UriEndpointMapping">
<property name="mappings">
<props>
<!-- TODO use config property for host -->
<prop key="${service.endpoint.url}/SNTWS/service/ConfigService">SOAPCompanyGateway</prop>
<prop key="${service.endpoint.url}/SNTWS/service/CompanyService">SOAPCompanyGateway</prop>
<prop key="${service.endpoint.url}/SNTWS/service/ContactService">SOAPContactGateway</prop>
<!-- TODO add default mapping -->
</props>
</property>
<property name="interceptors">
<array>
<ref bean="SOAPSecurityInterceptor"></ref>
</array>
</property>
</bean>
<bean id="SOAPSecurityInterceptor"
class="com.ps.snt.ws.interceptor.SOAPSecurityInterceptor">
<property name="validationActions" value="UsernameToken"/>
</bean>
索普公司大道
索普公司大道
SOAPContactGateway
我可以使用SPEL访问此信息吗?例如,我可以这样做(psuedo代码):
所有SOAP头都被映射到消息头(默认情况下)。甚至像ws-security这样的东西?我不能说我自己使用过它,但它看起来确实是这样的:我验证了DefaultSoapHeaderMapper正在返回wsse:security头(我可以稍后取消对其进行处理),但在流中稍后未设置头。“稍后在流中”-您正在使用持久通道吗?您可能需要更早地解组它;我建议您打开调试日志记录并跟踪头以查看它被丢弃的位置。发现问题-我需要将映射器的requestHeaderNames属性设置为*(全部)或者我正在寻找的特定标题。感谢您在正确的方向推动!
<int:header-enricher input-channel="SOAPConfigRequestChannel"
output-channel="SOAPRequestChannel">
<int:header name="username" value="message.getSecurity().getUserName()" />
</int:header-enricher>