gemmellr commented on a change in pull request #3849:
URL: https://github.com/apache/activemq-artemis/pull/3849#discussion_r752456648



##########
File path: 
artemis-server/src/main/java/org/apache/activemq/artemis/core/server/balancing/targets/TargetResult.java
##########
@@ -0,0 +1,42 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.activemq.artemis.core.server.balancing.targets;
+
+public class TargetResult {
+
+   public static final TargetResult REFUSED_UNAVAILABLE_RESULT = new 
TargetResult(Status.REFUSED_UNAVAILABLE);
+   public static final TargetResult REFUSED_USE_ANOTHER_RESULT = new 
TargetResult(Status.REFUSED_USE_ANOTHER);
+
+   public Status status;
+   public Target target;
+
+   public TargetResult(Target t) {
+      this.target = t;
+      this.status = Status.OK;
+   }
+
+   private TargetResult(Status s) {
+      this.status = s;

Review comment:
       Probably shouldnt allow 'OK' status this way.

##########
File path: 
artemis-server/src/main/java/org/apache/activemq/artemis/core/server/balancing/targets/TargetResult.java
##########
@@ -0,0 +1,42 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.activemq.artemis.core.server.balancing.targets;
+
+public class TargetResult {
+
+   public static final TargetResult REFUSED_UNAVAILABLE_RESULT = new 
TargetResult(Status.REFUSED_UNAVAILABLE);
+   public static final TargetResult REFUSED_USE_ANOTHER_RESULT = new 
TargetResult(Status.REFUSED_USE_ANOTHER);
+
+   public Status status;
+   public Target target;

Review comment:
       Should be private, the constants shouldnt be easily mutable.

##########
File path: 
artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/broker/AMQPSessionCallback.java
##########
@@ -211,12 +211,13 @@ public void init(AMQPSessionContext protonSession, 
SASLResult saslResult) throws
                                                            true, //boolean xa,
                                                            (String) null, 
this, true, operationContext, manager.getPrefixes(), 
manager.getSecurityDomain());
       } else {
+         final String validatedUser = manager.getServer().validateUser(user, 
passcode, protonSPI.getProtonConnectionDelegate(), manager.getSecurityDomain());

Review comment:
       Unless there is only a single session callback created per connection 
(doesnt look that way) then this still doesnt feel right. Auth is per 
connection so it doesnt seem it should need to be doing this for each session 
creation. This method even takes and uses a connection SASLResult, which it 
presumably had to get from somewhere that should already have done this.




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


Reply via email to