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

[ISSUE #8107] 403 go to home page when modify user's password #8114

Merged
merged 1 commit into from
Apr 18, 2022

Conversation

onewe
Copy link
Collaborator

@onewe onewe commented Apr 8, 2022

  • use IdentityContextHolder instead of get user information from session

Problem:
问题:
Users restart nacos server and do not login again then users update password will get an error authorization failed
用户重启了 nacos server 端,并未重新登录. 在做修改用户密码时提示authorization failed

Cause:
原因:
The session information was lost by restart.
重启客户端session信息丢失

Fix:
修复:
Use IdentityContextHolder instead of sessions, When requests are cross the AuthFilter, the AuthFilter will set a IdentityContext object into IdentityContextHolder and clean it in the end
使用 IdentityContextHolder 替代从 session 中获取用户信息. 每次请求经过 AuthFilterIdentityContext 对象放入到 IdentityContextHolder 中并在请求结束时清空 IdentityContextHolder

Close #8107

Please do not create a Pull Request without creating an issue first.

Follow this checklist to help us incorporate your contribution quickly and easily:

  • Make sure there is a Github issue filed for the change (usually before you start working on it). Trivial changes like typos do not require a Github issue. Your pull request should address just this issue, without pulling in other changes - one PR resolves one issue.
  • Format the pull request title like [ISSUE #123] Fix UnknownException when host config not exist. Each commit in the pull request should have a meaningful subject line and body.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Write necessary unit-test to verify your logic correction, more mock a little better when cross module dependency exist. If the new feature or significant change is committed, please remember to add integration-test in test module.
  • Run mvn -B clean package apache-rat:check findbugs:findbugs -Dmaven.test.skip=true to make sure basic checks pass. Run mvn clean install -DskipITs to make sure unit-test pass. Run mvn clean test-compile failsafe:integration-test to make sure integration-test pass.

Copy link
Collaborator

@KomachiSion KomachiSion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. 慎用ThreadLocal
  2. 有必要修复吗? 我理解刷新一下页面即可。服务端重启之后,链接闪断,session关闭,我觉得是正常的

@KomachiSion KomachiSion added the kind/discussion Category issues related to discussion label Apr 11, 2022
@onewe
Copy link
Collaborator Author

onewe commented Apr 11, 2022

主要界面不会让用户退出重新登录,刷新页面问题同样存在

@onewe
Copy link
Collaborator Author

onewe commented Apr 11, 2022

或者 我改改前端 401 之后就直接跳转到主页面,让用户重新登录即可

@KomachiSion
Copy link
Collaborator

或者 我改改前端 401 之后就直接跳转到主页面,让用户重新登录即可

这个方法或许比较好

@onewe
Copy link
Collaborator Author

onewe commented Apr 13, 2022

@KomachiSion 搞定

@onewe onewe changed the title [ISSUE #8107] Can't get user information from session [ISSUE #8107] 403 go to home page when modify user's password Apr 13, 2022
@KomachiSion KomachiSion merged commit dba1cf5 into alibaba:develop Apr 18, 2022
@KomachiSion KomachiSion added area/Nacos console Related to Nacos consle kind/enhancement Category issues or prs related to enhancement. and removed kind/discussion Category issues related to discussion labels Apr 18, 2022
@KomachiSion KomachiSion added this to the 2.1.0 milestone Apr 18, 2022
@onewe onewe deleted the issues/8107 branch April 19, 2022 22:58
@KeithTt
Copy link

KeithTt commented May 20, 2022

遇到了这个问题,很奇怪的是,用默认管理员用户 nacos 修改普通用户密码也会自动登出跳转到登陆页面。

一般情况下,不是用户修改自身密码才会登出重新登陆吗?

@onewe
Copy link
Collaborator Author

onewe commented May 20, 2022

@KeithTt 这个问题的本质是 seesion 失效了 JWTtoken 没有失效

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/Nacos console Related to Nacos consle kind/enhancement Category issues or prs related to enhancement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

nacos2.0.4 开启鉴权后 所有账号更改密码报错
3 participants