本文章摘编、转载需要注明来源 http://write.blog.csdn.net/postedit/8576449
先来配置下web.xml,HttpSessionEventPublisher是使用session管理时需要用到的
securityFilterChainProxy
org.springframework.web.filter.DelegatingFilterProxy
securityFilterChainProxy
/*
接着我们要配置一条过滤链(值得注意的是这个bean的id要跟web.xml里配置的filter-name要一致才可以)
下面我们逐个filter来看
首先是filterSecurityInterceptor,这是资源访问第一个要过的filter,至于这里面的属性注入请看我之前的spring security3 自定义权限管理的那篇文章
然后是异常捕获的filter,里面有两个属性需要注入,authenticationEntryPoint是配置默认跳转的,accessDeniedHandler是配置当检测无权限访问跳转
然后是logoutFilter,这个过滤器主要是做安全注销功能,注入rememberMeServices属性是为了安全退出的时候把记住密码的状态也删除了
然后是securityContextPersistenceFilter,这个过滤器是为了持久化SecurityContext实例
然后大致的过滤链就配置好了,对于cas等那些有需要用到的filter就自己看看源码,放到链条里就可以了