Description
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]
d. 'if' statement can be simplified.[line 146]
e. The "{}" is redundant.[line 90,134]
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.
d. Replace this if-then-else statement by a single return statement
Are you willing to submit PR?
- Yes I am willing to submit a PR!