Spring Security多重身份验证过滤器

时间:2014-03-03 10:42:47

标签: spring spring-security

在我的项目中,我已经在spring-security-context.xml文件中声明了两个身份验证过滤器,如下所述

    <beans:bean id="springSecurityFilterChain" class="org.springframework.security.web.FilterChainProxy">
    <sec:filter-chain-map path-type="ant">
        <sec:filter-chain pattern="/**" filters="authenticationProcessingFilterWithDB, authenticationProcessingFilterWithXML" />
    </sec:filter-chain-map>
    </beans:bean>

我已按以下方式为每个过滤器声明了身份验证管理器:

<beans:bean id="authenticationProcessingFilterWithDB" class="org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter">
    <beans:property name="authenticationManager" ref="authenticationManagerWithDB" />
    <beans:property name="filterProcessesUrl" value="/j_spring_security_check_with_db" />
</beans:bean>


<beans:bean id="authenticationProcessingFilterWithXML" class="org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter">
    <beans:property name="authenticationManager" ref="authenticationManagerWithXML" />
    <beans:property name="filterProcessesUrl" value="/j_spring_security_check_with_xml" />
</beans:bean>

但是当我尝试从jsp访问/ j_spring_security_check_with_xml时,它会给资源找不到错误。如果使用单个身份验证管理器提供默认的'/ j_spring_security_check',则同样有效。请给出在spring security中添加多个身份验证管理器的解决方案,因为我应该能够针对xml文件(将提供用户名和密码)验证登录详细信息,而不是数据库

0 个答案:

没有答案
相关问题