SpringSecurity过滤器链涉及组件绘图总结(十五)

1.请求到SpringSecurity过滤器流程汇总图

1.请求发送到服务器端口,被tomcat监听到并转化为request,response

2.请求在tomcat中进入过滤器链ApplicationFilterChain

3.进入过滤器DelegatingFilterProxy(SpringSecurity创建并注入到过滤器链)

4.通过DelegatingFilterProxy持有的bean名称,从Spring容器中获取FilterChainProxy

5.FilterChainProxy 持有多条过滤器链SecurityFIlterChain,每条过滤器链可能包含一个或多个过滤器

6.FilterChainProxy根据request请求选择SecurityFilterChain并获取Filter集合

7.FilterChainProxy创建VirtualFilterChain,并注入6获取的Filter集合。进入SpringSecurity过滤器链执行流程。
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-7AHEP0BO-1626416772254)(https://s3-us-west-2.amazonaws.com/secure.notion-static.com/bc4cf908-83c8-47d5-9294-8deeeecc86dc/06_security.png)]



2. SecurityContextHolder 结构图

SecurityContextHolder通过SecurityContextHolderStragedy来存储SecurityContext。

SecurityContext持有Authentication

Authentication持有GrantedAuthority,Credentials,Details,Principal

不同的认证方式有不同的Authentication实现类

不同的Authentication实现类由不同的AuthenticationManager进行认证

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-qavyQbIz-1626416772257)(https://s3-us-west-2.amazonaws.com/secure.notion-static.com/b2e70a6f-ac86-48e3-9b69-cdca9c5477c1/07_SecurityContextHolder.png)]



3.AuthenticationManager认证管理器

AuthenticationManager提供了认证功能,而其默认实现ProviderManager管理了一个AuthenticationProvider集合,它将具体的认证实现交给AuthenticationProvider。
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-3txGcQpM-1626416772259)(https://s3-us-west-2.amazonaws.com/secure.notion-static.com/cf29d86f-1372-4f29-8546-f9e08ef54e8a/08_AuthenticationManager.png)]



4. AbstractAuthenticationProcessingFilter 认证处理器

通过attemptAuthentication钩子方法,各个子类通过AuthenticationManager来完成认证过程。

流程图:
在这里插入图片描述



5.FilterSecurityInterceptor之AccessDecisionManager授权体系图

FilterSecurityInterceptor通过AccessDecisionManager去决定url是否通行。

AccessDecisionManager通过AccessDecisionVoter去进行投票,然后根据获取的投票来决定是通过还是不通过。

体系图:
在这里插入图片描述

  • 2
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 4
    评论
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

欢谷悠扬

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值