需要通过https和spring security进行身份验证吗?

Set*_*eth 2 security authentication encryption tomcat cryptography

我正在使用tomcat 6,spring mvc 3.0.0和spring security 3.0.0,并且由于我在数据库中存储的密码是sha1哈希,我不能使用摘要式身份验证(文档的第9.2.1节说明了).出于这个原因,我需要通过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>
Run Code Online (Sandbox Code Playgroud)

谢谢您的帮助.

roo*_*ook 6

如果您在任何时候通过HTTP传递会话ID,则表示您违反了OWASP A9.如果攻击者拥有会话ID,则不需要密码.我不会在你的应用程序中实现这个功能,https非常轻量级,我认为你应该考虑在那些并不意味着你的客户端会被攻击的地方节省资源.