clebertsuconic commented on code in PR #6396:
URL: https://github.com/apache/artemis/pull/6396#discussion_r3168388988


##########
artemis-server/src/main/java/org/apache/activemq/artemis/core/security/impl/SecurityStoreImpl.java:
##########
@@ -384,6 +375,38 @@ public boolean hasPermission(final SimpleString address,
       }
    }
 
+   private String handleClusterAuthentication(String user, String password, 
RemotingConnection connection) throws ActiveMQSecurityException {
+      ClusterCredentialsCheckResult checkResult = 
checkClusterCredentials(user, password);
+
+      if (checkResult == ClusterCredentialsCheckResult.VALID) {
+         AUTHENTICATION_SUCCESS_COUNT_UPDATER.incrementAndGet(this);
+         return user;
+      } else if (checkResult == ClusterCredentialsCheckResult.INVALID) {
+         AUTHENTICATION_FAILURE_COUNT_UPDATER.incrementAndGet(this);
+         throw ActiveMQMessageBundle.BUNDLE.unableToValidateUser(connection == 
null ? "null" : connection.getRemoteAddress(), user, null);
+      } else {
+         return null;
+      }
+   }
+
+   private ClusterCredentialsCheckResult checkClusterCredentials(String user, 
String password) {
+      if ((getDefaultClusterUser().equals(user) && 
getDefaultClusterPassword().equals(password)) ||
+         (managementClusterUser.equals(user) && 
!managementClusterPassword.equals(password))) {

Review Comment:
   I would make this a separate branch on the if... I think it would be clearer



-- 
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