• 【细度经典】阅读spring security 官方文档Architecture部分


    开始首先介绍了Servlet Filters

    官网中提到

    so it is helpful to look at the role of Filters generally first.

    说明spring security 一系列操作是由Filters 完成的

    在这里插入图片描述
    接下来由上到下,介绍了全部的过滤代理器

    DelegatingFilterProxy

    spring 提供的一个实现:
    我们来看看代码就明白了:
    在这里插入图片描述

    其实就是在过滤链中定义了一个位置,并且这个过滤器可以使用spring容器中的bean,我们看官方描述:Spring provides a Filter implementation named DelegatingFilterProxy that allows bridging between the Servlet container’s lifecycle and Spring’s ApplicationContext.

    FilterChainProxy

    这是spring security 提供的一个特殊过滤器,用来匹配对应的SecurityFilterChain,我们看官网描述: FilterChainProxy to determine which Spring Security Filters should be invoked for this request.
    在这里插入图片描述

    SecurityFilterChain

    真正的过滤链,一个过滤链包含n个过滤器
    在这里插入图片描述

    Security Filters

    真正通过的过滤器,其中有一些我们耳熟能详的过滤器。
    Below is a comprehensive list of Spring Security Filter ordering:

    • ForceEagerSessionCreationFilter

    • ChannelProcessingFilter

    • WebAsyncManagerIntegrationFilter

    • SecurityContextPersistenceFilter

    • HeaderWriterFilter

    • CorsFilter

    • CsrfFilter

    • LogoutFilter

    • OAuth2AuthorizationRequestRedirectFilter

    • Saml2WebSsoAuthenticationRequestFilter

    • X509AuthenticationFilter

    • AbstractPreAuthenticatedProcessingFilter

    • CasAuthenticationFilter

    • OAuth2LoginAuthenticationFilter

    • Saml2WebSsoAuthenticationFilter

    • UsernamePasswordAuthenticationFilter

    • OpenIDAuthenticationFilter

    • DefaultLoginPageGeneratingFilter

    • DefaultLogoutPageGeneratingFilter

    • ConcurrentSessionFilter

    • DigestAuthenticationFilter

    • BearerTokenAuthenticationFilter

    • BasicAuthenticationFilter

    • RequestCacheAwareFilter

    • SecurityContextHolderAwareRequestFilter

    • JaasApiIntegrationFilter

    • RememberMeAuthenticationFilter

    • AnonymousAuthenticationFilter

    • OAuth2AuthorizationCodeGrantFilter

    • SessionManagementFilter

    • ExceptionTranslationFilter

    • FilterSecurityInterceptor

    • SwitchUserFilter

    Handling Security Exceptions

    单独说明了一下当出现异常的时候(比如未认证,等待其他异常) 是由谁来统一处理
    在这里插入图片描述

  • 相关阅读:
    java 入土--集合详解
    (一)什么是消息中间件
    类和对象(2)
    Dubbo框架基本使用
    【Reinforcement Learning】AlphaGo 如何使用的强化学习?
    C/C++学生综合测评系统
    学习加密(三)spring boot 使用RSA非对称加密,前后端传递参数加解密
    DataGridView绑定数据更新
    【Linux】VI和VIM命令详解
    构建空间场景轻应用,Mapmost Alpha来啦【文末赠书(10本)--第一期】
  • 原文地址:https://blog.csdn.net/weixin_42842069/article/details/125524483