[jira] [Commented] (ARTEMIS-1921) Setting client ID on core JMS should be reflected in broker RemotingConnection

2024-04-18 Thread ASF subversion and git services (Jira)


[ 
https://issues.apache.org/jira/browse/ARTEMIS-1921?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17838598#comment-17838598
 ] 

ASF subversion and git services commented on ARTEMIS-1921:
--

Commit 791630fa861f868beb3e2d778eb44f92117b0220 in activemq-artemis's branch 
refs/heads/main from Justin Bertram
[ https://gitbox.apache.org/repos/asf?p=activemq-artemis.git;h=791630fa86 ]

ARTEMIS-1921 setting client ID on core JMS should be reflected in broker 
RemotingConnection


> Setting client ID on core JMS should be reflected in broker RemotingConnection
> --
>
> Key: ARTEMIS-1921
> URL: https://issues.apache.org/jira/browse/ARTEMIS-1921
> Project: ActiveMQ Artemis
>  Issue Type: Bug
>  Components: Broker
>Affects Versions: 2.6.1
>Reporter: Johan Stenberg
>Assignee: Justin Bertram
>Priority: Major
> Attachments: Artemis1921_CoreJmsClient_SetClientId_Test.java
>
>  Time Spent: 20m
>  Remaining Estimate: 0h
>
> As opposite to Qpid JMS Client over AMPQ1.0 or FuseSource StompJMS client 
> over STOMP, a clientID set on the JMS ConnectionFactory or the Connection in 
> the Artemis JMS Client is not available on the broker via 
> RemotingConnection#getClientID().



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (ARTEMIS-1921) Setting client ID on core JMS should be reflected in broker RemotingConnection

2024-04-18 Thread Robbie Gemmell (Jira)


[ 
https://issues.apache.org/jira/browse/ARTEMIS-1921?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17838597#comment-17838597
 ] 

Robbie Gemmell commented on ARTEMIS-1921:
-

Yep, wasn't commenting on the change (hadn't looked yet) but just the earlier 
reply around why it didnt work (but doing one or the other probably did 
previously due to other oddness). Have looked at the new change now and looks 
good.

> Setting client ID on core JMS should be reflected in broker RemotingConnection
> --
>
> Key: ARTEMIS-1921
> URL: https://issues.apache.org/jira/browse/ARTEMIS-1921
> Project: ActiveMQ Artemis
>  Issue Type: Bug
>  Components: Broker
>Affects Versions: 2.6.1
>Reporter: Johan Stenberg
>Assignee: Justin Bertram
>Priority: Major
> Attachments: Artemis1921_CoreJmsClient_SetClientId_Test.java
>
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> As opposite to Qpid JMS Client over AMPQ1.0 or FuseSource StompJMS client 
> over STOMP, a clientID set on the JMS ConnectionFactory or the Connection in 
> the Artemis JMS Client is not available on the broker via 
> RemotingConnection#getClientID().



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (ARTEMIS-1921) Setting client ID on core JMS should be reflected in broker RemotingConnection

2024-04-16 Thread Justin Bertram (Jira)


[ 
https://issues.apache.org/jira/browse/ARTEMIS-1921?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17837970#comment-17837970
 ] 

Justin Bertram commented on ARTEMIS-1921:
-

The client ID won't be available to the security manager, but it can be 
available on the internal {{RemotingConnection}} which will be visible via JMX. 
This is already the case for AMQP and OpenWire. The fix for this issue will do 
this for Core.

> Setting client ID on core JMS should be reflected in broker RemotingConnection
> --
>
> Key: ARTEMIS-1921
> URL: https://issues.apache.org/jira/browse/ARTEMIS-1921
> Project: ActiveMQ Artemis
>  Issue Type: Bug
>  Components: Broker
>Affects Versions: 2.6.1
>Reporter: Johan Stenberg
>Priority: Major
> Attachments: Artemis1921_CoreJmsClient_SetClientId_Test.java
>
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> As opposite to Qpid JMS Client over AMPQ1.0 or FuseSource StompJMS client 
> over STOMP, a clientID set on the JMS ConnectionFactory or the Connection in 
> the Artemis JMS Client is not available on the broker via 
> RemotingConnection#getClientID().



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (ARTEMIS-1921) Setting client ID on core JMS should be reflected in broker RemotingConnection

2024-04-16 Thread Robbie Gemmell (Jira)


[ 
https://issues.apache.org/jira/browse/ARTEMIS-1921?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17837645#comment-17837645
 ] 

Robbie Gemmell commented on ARTEMIS-1921:
-

Not sure we should be expecting a response after 6 years, but it seems possible 
the code was a minimal attempt to show 'it isnt available on Core at all' 
rather than simply 'it is available at this point on the others', perhaps the 
use case is something else later where it is available on the others. Or maybe 
some behaviour changed in those 6 years and it used to be available; I actually 
think it might have in the AMQP case, I seem to recall it doing something odd 
like calling the auth methods when the first session opened like Core. Not sure 
it does that anymore.

The ClientID wont be available at the point Qpid JMS actually goes through the 
SASL process, since it hasnt been sent yet, regardless how the client is 
configured, auth happens 'before connection' rather than during. If the broker 
fails the SASL negotiation, the client wont even get as far as starting a bare 
AMQP connection which is where the ClientId is carried as the container-id.

I presume it is failing auth in this case and throwing. If it doenst fail auth, 
the test/application code will still throw with Qpid JMS since it is _both_ 
setting the ClientID up front 'administratively', and then also trying to set 
it after Connection creation, whereas you can only do one or the other. The 
second will throw an ISE if it gets that far.

> Setting client ID on core JMS should be reflected in broker RemotingConnection
> --
>
> Key: ARTEMIS-1921
> URL: https://issues.apache.org/jira/browse/ARTEMIS-1921
> Project: ActiveMQ Artemis
>  Issue Type: Bug
>  Components: Broker
>Affects Versions: 2.6.1
>Reporter: Johan Stenberg
>Priority: Major
> Attachments: Artemis1921_CoreJmsClient_SetClientId_Test.java
>
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> As opposite to Qpid JMS Client over AMPQ1.0 or FuseSource StompJMS client 
> over STOMP, a clientID set on the JMS ConnectionFactory or the Connection in 
> the Artemis JMS Client is not available on the broker via 
> RemotingConnection#getClientID().



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (ARTEMIS-1921) Setting client ID on core JMS should be reflected in broker RemotingConnection

2024-04-15 Thread Justin Bertram (Jira)


[ 
https://issues.apache.org/jira/browse/ARTEMIS-1921?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17837405#comment-17837405
 ] 

Justin Bertram commented on ARTEMIS-1921:
-

[~johan1], upon closer inspection I can't get your attached code to work with 
Qpid JMS. The client ID is *not* available during authentication. Here's the 
test I'm running:
{code:java}
import javax.jms.Connection;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;

import org.apache.activemq.artemis.api.core.TransportConfiguration;
import org.apache.activemq.artemis.core.config.impl.ConfigurationImpl;
import 
org.apache.activemq.artemis.core.remoting.impl.netty.NettyAcceptorFactory;
import org.apache.activemq.artemis.core.remoting.impl.netty.TransportConstants;
import org.apache.activemq.artemis.core.security.CheckType;
import org.apache.activemq.artemis.core.security.Role;
import org.apache.activemq.artemis.core.server.embedded.EmbeddedActiveMQ;
import org.apache.activemq.artemis.spi.core.protocol.RemotingConnection;
import org.apache.activemq.artemis.spi.core.security.ActiveMQSecurityManager3;
import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.apache.qpid.jms.JmsConnectionFactory;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

public class Artemis1921 extends ActiveMQTestBase {

   private EmbeddedActiveMQ broker;

   @Before
   public void setup() throws Exception {
  broker = new EmbeddedActiveMQ();
  broker.setSecurityManager(new ActiveMQSecurityManager3() {
 @Override
 public boolean validateUserAndRole(final String user, final String 
password, final Set roles, final CheckType checkType) {
return validateUser(user, password);
 }

 @Override
 public boolean validateUser(final String user, final String password) {
return "foo".equals(user) && "bar".equals(password);
 }

 @Override
 public String validateUserAndRole(final String user, final String 
password, final Set roles, final CheckType checkType, final String 
address,
   final RemotingConnection 
remotingConnection) {
return validateUser(user, password, remotingConnection);
 }

 @Override
 public String validateUser(final String user, final String password, 
final RemotingConnection remotingConnection) {
final String clientID = remotingConnection.getClientID();
if (clientID == null) {
   System.err.println("*");
   System.err.println("* No clientID set!");
   System.err.println("*");
   return null;
}
return validateUser(user, password) ? user : null;
 }
  });
  final TransportConfiguration transportCfg = new 
TransportConfiguration(NettyAcceptorFactory.class.getName());
  transportCfg.getParams().put(TransportConstants.PROTOCOLS_PROP_NAME, 
"CORE,AMQP");
  transportCfg.getParams().put(TransportConstants.HOST_PROP_NAME, 
"0.0.0.0");
  transportCfg.getParams().put(TransportConstants.PORT_PROP_NAME, "61616");
  broker.setConfiguration(new ConfigurationImpl()
 .setPersistenceEnabled(false)
 .setSecurityEnabled(true)
 .setAcceptorConfigurations(new 
HashSet<>(Arrays.asList(transportCfg)))
  );

  broker.start();
   }

   @After
   public void tearDown() throws Exception {
  broker.stop();
   }

   @Test
   public void testJMSConnect() throws Exception {
  final JmsConnectionFactory jmsCF = new 
JmsConnectionFactory("amqp://localhost:61616");
  jmsCF.setUsername("foo");
  jmsCF.setPassword("bar");
  jmsCF.setClientID("foo_001"); // trying to set clientID on CF
  final Connection jmsConn = jmsCF.createConnection();
  jmsConn.setClientID("foo_001"); // trying to set clientID on connection
  jmsConn.start();
  jmsConn.close();
   }
}{code}
This code doesn't work for any of the supported JMS clients (i.e. Core JMS, 
Qpid JMS, and OpenWire JMS).

> Setting client ID on core JMS should be reflected in broker RemotingConnection
> --
>
> Key: ARTEMIS-1921
> URL: https://issues.apache.org/jira/browse/ARTEMIS-1921
> Project: ActiveMQ Artemis
>  Issue Type: Bug
>  Components: Broker
>Affects Versions: 2.6.1
>Reporter: Johan Stenberg
>Priority: Major
> Attachments: Artemis1921_CoreJmsClient_SetClientId_Test.java
>
>
> As opposite to Qpid JMS Client over AMPQ1.0 or FuseSource StompJMS client 
> over STOMP, a clientID set on the JMS ConnectionFactory or the Connection in