0
我已经发布了使用spring启动的spring web服务。在WsConfigurerAdapter中,我使用了带有SimplePasswordValidationCallback的XwsSecurityInterceptor来验证用户,这很好。Spring WS UsernameToken认证+通过spring-boot进行会话管理
web配置,
@Bean
XwsSecurityInterceptor securityInterceptor() {
XwsSecurityInterceptor securityInterceptor = new XwsSecurityInterceptor();
securityInterceptor.setCallbackHandler(callbackHandler());
securityInterceptor.setPolicyConfiguration(new ClassPathResource("securityPolicy.xml"));
return securityInterceptor;
}
@Bean
CallBackHandlerHelper callbackHandler() {
CallBackHandlerHelper callbackHandler = new CallBackHandlerHelper();
callbackHandler.loadUsers(); // loading users from DB
return callbackHandler;
}
样品皂报头。
<soapenv:Header>
<wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<wsse:UsernameToken wsu:Id="XWSSGID-14072105829651149256297" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<wsse:Username>admin</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">1</wsse:Password>
</wsse:UsernameToken>
</wsse:Security>
</soapenv:Header>
现在,我与这些02顾虑挣扎,
1)如何使用密码消化和随机数,比明文。 (在我的策略xml中,我已将它们设置为false,并通过SOAP头以明文格式加载wss:usernameToken,但我更喜欢获取密码摘要而不是plainText格式)。
2)我需要通过保持会话密钥将此服务设置为有状态。不想每次都发送用户/密码。想法是只使用用户名令牌来登录请求,并在此后用一个唯一的密钥来管理会话,直到用户发送注销请求(希望将这个生成的会话密钥保存在内存中,直到会话关闭)我怎么能想到解决这个问题给定的上下文?