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

[Enhancement] Do some code optimization[AuthTokenUtils] #3515

Closed
1 of 2 tasks
Alonexc opened this issue Mar 22, 2023 · 4 comments · Fixed by #3644
Closed
1 of 2 tasks

[Enhancement] Do some code optimization[AuthTokenUtils] #3515

Alonexc opened this issue Mar 22, 2023 · 4 comments · Fixed by #3644
Labels
enhancement New feature or request good first issue Issues for first-time contributors

Comments

@Alonexc
Copy link
Contributor

Alonexc commented Mar 22, 2023

Search before asking

  • I had searched in the issues and found no similar issues.

Enhancement Request

located at:
eventmesh-security-plugin/eventmesh-security-auth-token/src/main/java/org/apache/eventmesh/auth/token/impl/auth/AuthTokenUtils.java
analysis and explanation:
a. The logic of "authTokenByPublicKey" and "helloTaskAuthTokenByPublicKey" method in lines "54-87" and "99-132" is the same, so it can be extracted as one method.
b. Variable 'validationKeyBytes' initializer 'new byte[0]' is redundant.[line 66,111]
c. Argument 'publicKeyUrl' might be null.[line 68,113]
image

d. 'if' statement can be simplified.[line 146]
image

e. The "{}" is redundant.[line 90,134]
image

Describe the solution you'd like

a. Repeat the logic code extracted as a method.
b. Remove redundant initializers.
c. Use 'Objects.requireNonNull()' to avoid an NPE.
image

d. Replace this if-then-else statement by a single return statement
image

e. Remove the extra "{}".
image

Are you willing to submit PR?

  • Yes I am willing to submit a PR!
@himansh295
Copy link
Contributor

@Alonexc @xwm1992 @kyooosukedn Can I work on this issue?

@Alonexc
Copy link
Contributor Author

Alonexc commented May 15, 2023

@himansh295 Currently there are pr submissions, you can look at other issues.

Copy link
Contributor

It has been 90 days since the last activity on this issue. Apache EventMesh values the voices of the community. Please don't hesitate to share your latest insights on this matter at any time, as the community is more than willing to engage in discussions regarding the development and optimization directions of this feature.

If you feel that your issue has been resolved, please feel free to close it. Should you have any additional information to share, you are welcome to reopen this issue.

@github-actions github-actions bot added the Stale label Apr 22, 2024
@yangsl960702
Copy link

请问该问题已经有人解决了吗,如果没有,我可以做尝试吗

@github-actions github-actions bot removed the Stale label May 10, 2024
Pil0tXia pushed a commit that referenced this issue Jun 1, 2024
* Code optimization

* Remove unused imports

* Added one forgotten import 'Objects'

* Added Constants import

* removed unnecessary space

* fixed code optimization

* corrected some small changes

* redundant lines

* redundant lines

* optimized returned reply in subscribe method

* reverted correct change

* reverted back
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Issues for first-time contributors
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants