-
Notifications
You must be signed in to change notification settings - Fork 49
Description
Is your feature request related to a problem? Please describe.
I have a RabbitMQ server with EXTERNAL Authentication Mechanisms enabled for Mutual TLS / Client Certificate Authentication:
auth_mechanisms.1 = EXTERNAL
ssl_cert_login_from = common_name
I can connect to the server using com.rabbitmq.client.ConnectionFactory with setSaslConfig(DefaultSaslConfig.EXTERNAL) (and also presenting the client certificate of course).
However, I cannot find a similar option in the JMS connection factory: com.rabbitmq.jms.admin.RMQConnectionFactory.
I need to use the JMS capable connection factory in my code because we have generic modules depending on the JMS API. That's why the "lower level" com.rabbitmq.client.ConnectionFactory is not appropriate for me.
Describe the solution you'd like
com.rabbitmq.jms.admin.RMQConnectionFactory could be extended with setSaslConfig(SaslConfig) method. Under the hood the class uses com.rabbitmq.client.ConnectionFactory and the SaslConfig parameter could be passed over to it somewhere here:
rabbitmq-jms-client/src/main/java/com/rabbitmq/jms/admin/RMQConnectionFactory.java
Lines 294 to 302 in 5149899
| com.rabbitmq.client.ConnectionFactory cf = createConnectionFactory(); | |
| maybeEnableTLS(cf); | |
| setRabbitUri(logger, this, cf, getUri()); | |
| maybeEnableHostnameVerification(cf); | |
| cf.setMetricsCollector(this.metricsCollector); | |
| if (this.amqpConnectionFactoryPostProcessor != null) { | |
| this.amqpConnectionFactoryPostProcessor.accept(cf); | |
| } |
Describe alternatives you've considered
As a workaround, RMQConnectionFactory.setAmqpConnectionFactoryPostProcessor() is available now and can be used for this purpose but it is not really straightforward:
RMQConnectionFactory factory = new RMQConnectionFactory();
factory.setAmqpConnectionFactoryPostProcessor(cf -> cf.setSaslConfig(DefaultSaslConfig.EXTERNAL));
RMQConnectionFactory.setSaslConfig(SaslConfig) would be a more developer-friendly API and it does not seem a huge effort.
Thanks for considering it!
Additional context
No response