我是Spring Integration的新手。如何将ws-security用户名标记放入Spring Integration标头中。我理解如何添加Wss4jSecurityInterceptor来验证用户名,但由于这是一个拦截器,我无法访问Mwssage对象。将消息解组到JAB对象后,我将丢失对SOAP标头的引用。
<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>
我可以使用SPEL访问此信息吗?例如,我可以这样做(伪代码):
<int:header-enricher input-channel="SOAPConfigRequestChannel"
output-channel="SOAPRequestChannel">
<int:header name="username" value="message.getSecurity().getUserName()" />
</int:header-enricher>