[英]How to get ws-security username into Spring Integration message header
我是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>
所有SOAP標頭都通過DefaultSoapHeaderMapper映射到消息標頭(默認情況下)。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.