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 #12719] refresh the client's access token #12758

Closed
wants to merge 29 commits into from

Conversation

lucky8987
Copy link
Contributor

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

What is the purpose of the change

from issues 12719

Brief changelog

  1. Modify the login logic in the NacosClientAuthServiceImpl code to record the refresh time of the token in the 'LoginIdentity Context'.

  2. When the response code is determined to be 403 on the client side, set the parameter 'NextRefreshTime' in 'Login Identity Context' to 0.

  3. After waiting for the timer task for 5 seconds, enter the login process and refresh the token.


  1. 修改代码NacosClientAuthServiceImpl中的登录逻辑,将Token的刷新时间记录到 LoginIdentityContext 中。
  2. 在 client 端判断response code 为 403 时将 LoginIdentityContext 里面的参数 nextRefreshTime 设置为 0。
  3. 等待定时器任务5秒后进入登录流程,进行Token刷新。

Verifying this change

Modify the nacos.cre.auth.plugin.nacos.token.secreet.key parameter in the application and observe whether the client performs a re login operation

yanlinly and others added 24 commits June 5, 2020 16:31
Merge develop to master, upgrade version to 1.4.2
Merge develop into master to release 2.2.0
@CLAassistant
Copy link

CLAassistant commented Oct 17, 2024

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
2 out of 4 committers have signed the CLA.

✅ KomachiSion
✅ lucky8987
❌ xuande
❌ yanlinly
You have signed the CLA already but the status is still pending? Let us recheck it.

Copy link

Thanks for your this PR. 🙏
Please check again for your PR changes whether contains any usage/api/configuration change such as Add new API , Add new configuration, Change default value of configuration.
If so, please add or update documents(markdown type) in docs/next/ for repository nacos-group/nacos-group.github.io


感谢您提交的PR。 🙏
请再次查看您的PR内容,确认是否包含任何使用方式/API/配置参数的变更,如:新增API新增配置参数修改默认配置等操作。
如果是,请确保在提交之前,在仓库nacos-group/nacos-group.github.io中的docs/next/目录下添加或更新文档(markdown格式)。

@codecov-commenter
Copy link

codecov-commenter commented Oct 17, 2024

Codecov Report

Attention: Patch coverage is 86.36364% with 3 lines in your changes missing coverage. Please review.

Project coverage is 71.30%. Comparing base (2b178be) to head (5cff092).

Files with missing lines Patch % Lines
...m/alibaba/nacos/client/security/SecurityProxy.java 66.66% 1 Missing and 2 partials ⚠️
Additional details and impacted files

Impacted file tree graph

@@              Coverage Diff              @@
##             develop   #12758      +/-   ##
=============================================
+ Coverage      71.29%   71.30%   +0.01%     
- Complexity      9660     9666       +6     
=============================================
  Files           1278     1278              
  Lines          41080    41098      +18     
  Branches        4345     4350       +5     
=============================================
+ Hits           29286    29304      +18     
+ Misses          9732     9730       -2     
- Partials        2062     2064       +2     
Files with missing lines Coverage Δ
...nacos/client/auth/impl/NacosAuthLoginConstant.java 0.00% <ø> (ø)
...s/client/auth/impl/NacosClientAuthServiceImpl.java 100.00% <100.00%> (ø)
...lient/naming/remote/AbstractNamingClientProxy.java 100.00% <100.00%> (ø)
...ient/naming/remote/gprc/NamingGrpcClientProxy.java 98.35% <100.00%> (+0.02%) ⬆️
...ient/naming/remote/http/NamingHttpClientProxy.java 90.95% <100.00%> (+0.09%) ⬆️
...m/alibaba/nacos/client/security/SecurityProxy.java 89.65% <66.66%> (-10.35%) ⬇️

... and 4 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2b178be...5cff092. Read the comment docs.

@lucky8987 lucky8987 closed this Oct 18, 2024
@lucky8987 lucky8987 deleted the develop-issue#12719 branch October 19, 2024 12:46
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

Successfully merging this pull request may close these issues.

6 participants