Alonexc opened a new issue, #3515:
URL: https://github.com/apache/incubator-eventmesh/issues/3515

   ### Search before asking
   
   - [X] I had searched in the 
[issues](https://github.com/apache/eventmesh/issues?q=is%3Aissue) 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](https://user-images.githubusercontent.com/91315508/226837013-8e9dabef-0283-4ee4-af8e-6b5707203df0.png)
   
   d. 'if' statement can be simplified.[line 146]
   
![image](https://user-images.githubusercontent.com/91315508/226837052-acce4d6a-8674-4f0c-b224-2ab79524198a.png)
   
   e. The "{}" is redundant.[line 90,134]
   
![image](https://user-images.githubusercontent.com/91315508/226837100-ebe51044-b44d-45ac-af3a-316ae70ddec9.png)
   
   
   ### 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](https://user-images.githubusercontent.com/91315508/226837141-d5d01b94-4391-4871-a14a-3e3d43e0523f.png)
   
   d. Replace this if-then-else statement by a single return statement
   
![image](https://user-images.githubusercontent.com/91315508/226837194-860608fe-e0c1-44ca-b428-57f27c243daf.png)
   
   e. Remove the extra "{}".
   
![image](https://user-images.githubusercontent.com/91315508/226837239-3021ae1b-920f-4ec8-81c9-879c2146e2a4.png)
   
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to