Spring Security Multiple Authentication Filters
-
19-10-2022 - |
Question
In my project i have declared two authentication filters as mentioned below in spring-security-context.xml file
<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>
I have declared authentication manager for each filter in following way:
<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>
but when i try to access /j_spring_security_check_with_xml from jsp then it is giving resource not found error. The same is working if give default '/j_spring_security_check' with single authentication manager. Please give the solution for adding multiple authentication manager in spring security as i should be able to verify login details against xml file (where username and password will be provided),against Data base
No correct solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow