主要参考博文:Spring Security启动加载流程梳理
补充博文:DelegatingFilterProxy的作用与用法
<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>
org.springframework.web.filter.DelegatingFilterProxy
</filter-class>
</filter>
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
DelegatingFilterProxy是代理了Spring Context中id为springSecurityFilterChain的Bean,而这个类是在Spring Security的配置类中被注入到Spring Context的:

在构建的时候会根据不同的路径走不同的FilterChain:

参见这篇文章:Spring Security验证流程剖析及自定义验证方法

具体的请求过滤流程在具体的Filter中,大家可以下断点跟一下。
具体的配置信息是通过下面的方法注入进来的:

也就是程序中Security的配置:

类的继承关系如下:

1526

被折叠的 条评论
为什么被折叠?



