【发布时间】:2010-09-09 01:50:20
【问题描述】:
我使用的是 tomcat 6、spring mvc 3.0.0 和 spring security 3.0.0,由于我存储在数据库中的密码是 sha1 散列的,所以我不能使用摘要身份验证 (section 9.2.1 of the documentation spells that out)。因此,我需要通过 https 进行身份验证。
由于潜在的处理开销,我希望尽可能多地将流量保留在常规 http 中。有没有办法让spring对未经身份验证的请求使用https,然后在身份验证完成后使用http?我认为这是通过某种 ChannelProcessingFilter 完成的,但我对细节感到困惑。
这是我目前的 application-security.xml 文件:
<beans:beans xmlns="http://www.springframework.org/schema/security"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.0.xsd">
<http use-expressions="true">
<intercept-url pattern="/**" access="isAuthenticated()" />
<http-basic />
</http>
<authentication-manager>
<authentication-provider user-service-ref="myUserDetailsService">
<password-encoder hash="sha"/>
</authentication-provider>
</authentication-manager>
<beans:bean id="myUserDetailsService"
class="path.to.myUserDetailsServiceImpl">
</beans:bean>
</beans:beans>
感谢您的帮助。
【问题讨论】:
标签: security authentication tomcat encryption cryptography