Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SecurityContextHolder上下文 问题 #13

Open
jing001z opened this issue Nov 15, 2024 · 4 comments
Open

SecurityContextHolder上下文 问题 #13

jing001z opened this issue Nov 15, 2024 · 4 comments

Comments

@jing001z
Copy link

我想问一下UsernamePasswordAuthenticationToken不是在登录 login() 时已经放入了SpringSecurity的上下文了吗?
为啥在VerifyTokenFilter过滤器中又从token中jwt解析获取用户和权限然后再放入SpringSecurity的上下文中啊?这操作不是重复了吗?

@jing001z
Copy link
Author

SecurityContextHolder 不是 Spring Security 中的全局共享的上下文吗? 一个项目就一个,可以共享

@Alanosy
Copy link
Owner

Alanosy commented Nov 16, 2024

我想问一下UsernamePasswordAuthenticationToken不是在登录 login() 时已经放入了SpringSecurity的上下文了吗?

为啥在VerifyTokenFilter过滤器中又从token中jwt解析获取用户和权限然后再放入SpringSecurity的上下文中啊?这操作不是重复了吗?

login是登陆的初始验证,过滤器是对后续每个请求的验证

@Alanosy
Copy link
Owner

Alanosy commented Nov 16, 2024

SecurityContextHolder 不是 Spring Security 中的全局共享的上下文吗? 一个项目就一个,可以共享

我当时学的时候好像说这个管理上下文的工具,如果如果不和理欢迎修改代码提交pr到本仓库

@alixiaodi
Copy link

借楼主推一个刷题的APP https://www.lics.asia 开源的

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants