eventmesh icon indicating copy to clipboard operation
eventmesh copied to clipboard

[Enhancement] Do some code optimization[AuthTokenUtils]

Open Alonexc opened this issue 2 years ago • 3 comments

Search before asking

  • [X] 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!

Alonexc avatar Mar 22 '23 08:03 Alonexc

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

himansh295 avatar May 13 '23 13:05 himansh295

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

Alonexc avatar May 15 '23 07:05 Alonexc

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[bot] avatar Apr 22 '24 18:04 github-actions[bot]

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

yangsl960702 avatar May 10 '24 07:05 yangsl960702