我已经使用spring发布了spring服务。在WsConfigurerAdapter中,我使用XwsSecurityInterceptor和SimplePasswordValidationCallback对用户进行身份验证,这很好。
网络配置,
@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;
}
样本soap头。
<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)如何使用密码摘要和密码,而不是plainText。(在我的策略xml中,我将它们设置为false,并通过SOAP头以明文格式加载wss:usernameToken。但我更喜欢获得密码摘要,而不是plainText格式)。
2)通过保留会话密钥,我需要将此服务设置为有状态服务。不想每次发送用户/pwd。想法是只使用用户名令牌登录请求,然后使用唯一的密钥来管理会话,直到用户发送注销请求。(希望将生成的会话密钥保存在内存中直到会话结束),我应该如何在给定的上下文中解决这个问题呢?
https://stackoverflow.com/questions/27250055
复制相似问题