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 #9859] 重构默认插件的登陆/鉴权逻辑 #9889

Merged
merged 2 commits into from
Feb 3, 2023

Conversation

YunWZ
Copy link
Contributor

@YunWZ YunWZ commented Feb 1, 2023

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

What is the purpose of the change

重构默认插件的登陆/鉴权逻辑, 提高性能.

Brief changelog

不使用Spring-Security中的登陆鉴权逻辑,由鉴权插件自己实现:

  1. 优化登陆接口的逻辑,避免重复验证jwt(登陆时由插件自己生成令牌,无需重复验证);
  2. 优化AcessToken的验证逻辑;

Verifying this change

XXXX

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.

如果这个PR完成了, 是不是可以吧spring-security去掉?
这玩意太多安全工程师盯着了, 容易出漏洞。

@YunWZ
Copy link
Contributor Author

YunWZ commented Feb 2, 2023

如果这个PR完成了, 是不是可以吧spring-security去掉? 这玩意太多安全工程师盯着了, 容易出漏洞。

其实我尝试过移除spring-security, 但是发现移除了spring-security之后, console不能正常登陆了.
想要彻底移除spring-security的话, 可能需要前端大佬一起看下, 且其他需要鉴权的模块也需要改--例如address模块(依赖于naming)

@YunWZ YunWZ force-pushed the feature/refactor-auth-logic branch from 6ca94c2 to be3e294 Compare February 2, 2023 03:27
@YunWZ YunWZ force-pushed the feature/refactor-auth-logic branch from be3e294 to 06372e8 Compare February 2, 2023 03:28
@codecov-commenter
Copy link

codecov-commenter commented Feb 2, 2023

Codecov Report

Merging #9889 (06372e8) into develop (71389b0) will decrease coverage by 0.28%.
The diff coverage is 6.92%.

Additional details and impacted files

Impacted file tree graph

@@              Coverage Diff              @@
##             develop    #9889      +/-   ##
=============================================
- Coverage      47.36%   47.08%   -0.28%     
+ Complexity      4513     4500      -13     
=============================================
  Files            861      865       +4     
  Lines          28001    28110     +109     
  Branches        3121     3132      +11     
=============================================
- Hits           13263    13236      -27     
- Misses         13536    13679     +143     
+ Partials        1202     1195       -7     
Impacted Files Coverage Δ
...plugin/auth/impl/CustomAuthenticationProvider.java 0.00% <ø> (ø)
.../plugin/auth/impl/JwtAuthenticationEntryPoint.java 0.00% <ø> (ø)
...alibaba/nacos/plugin/auth/impl/LdapAuthConfig.java 0.00% <0.00%> (ø)
.../nacos/plugin/auth/impl/LdapAuthPluginService.java 0.00% <0.00%> (ø)
...libaba/nacos/plugin/auth/impl/NacosAuthConfig.java 0.00% <0.00%> (ø)
...ibaba/nacos/plugin/auth/impl/NacosAuthManager.java 0.00% <ø> (ø)
...nacos/plugin/auth/impl/NacosAuthPluginService.java 0.00% <0.00%> (ø)
...pl/authenticate/AbstractAuthenticationManager.java 0.00% <0.00%> (ø)
...l/authenticate/AuthenticationNamagerDelegator.java 0.00% <0.00%> (ø)
...mpl/authenticate/DefaultAuthenticationManager.java 0.00% <0.00%> (ø)
... and 11 more

Continue to review full report at Codecov.

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

@KomachiSion KomachiSion merged commit 42b28f9 into alibaba:develop Feb 3, 2023
@KomachiSion KomachiSion added plugin kind/enhancement Category issues or prs related to enhancement. labels Feb 3, 2023
@KomachiSion KomachiSion added this to the 2.2.1 milestone Feb 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement Category issues or prs related to enhancement. plugin
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature] 性能优化--重构默认鉴权插件中的JWT相关功能
3 participants