web.xml配置委托代理filter,filter-name默认与filter bean的名字保持一致。
1 <filter> 2 <filter-name>springSecurityFilterChain</filter-name> 3 <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class> 4 </filter> 5 <filter-mapping> 6 <filter-name>springSecurityFilterChain</filter-name> 7 <url-pattern>/*</url-pattern> 8 </filter-mapping>
过滤链代理配置
1 <!-- 自定义Spring Security过滤链 --> 2 <beans:bean id="springSecurityFilterChain" 3 class="org.springframework.security.web.FilterChainProxy"> 4 <beans:constructor-arg> 5 <beans:list> 6 <filter-chain pattern="/resources/**" filters="channelProcessingFilter" /> 7 <filter-chain pattern="/login" filters="channelProcessingFilter" /> 8 <filter-chain pattern="/" filters="channelProcessingFilter" /> 9 <filter-chain pattern="/error" filters="channelProcessingFilter" /> 10 <filter-chain pattern="/**" 11 filters="channelProcessingFilter,securityContextPersistenceFilter,usernamePasswordAuthenticationFilter,rememberMeAuthenticationFilter,logoutFilter, 12 exceptionTranslationFilter,concurrentSessionFilter,felicityFilterSecurityInterceptor" /> 13 </beans:list> 14 </beans:constructor-arg> 15 </beans:bean>
过滤链执行序列图