I am using apache qpid lib to connect to solace broker and subscribe on broker topic/queues using Basic auth, however instead of basic auth I want to use OAuth2 for authentication purpose. I tried same but it didn’t work.
I am getting the Authentication error - ‘Authentication has not completed yet - Could not find a suitable SASL mechanism for the remote peer using the available credentials’.
As per solace document, they support AMQP with OAUTH - ‘For AMQP clients, PubSub+ event brokers support the XOAUTH2 SASL authentication mechanism. In this case, the AMQP URL must be amqps://:?amqp.saslMechanisms=XOAUTH2.’ however for apache qpid lib, adding saslMechanisms in hostname isn’t supported. We have to give saslMechanisms in container options, and provide the token in ‘password’ field as per Solace doc. I did the same thing but it didn’t work.
Note: I already have enabled OAuth in my solace broker and currently using it with MQTT protocol.
// Programmatically create the connection factory using default settings
ConnectionFactory connectionFactory = (ConnectionFactory) new JmsConnectionFactory(solaceUsername,solacePassword,solaceHost);
// establish connection that uses the Solace Message Router as a message broker
try (JMSContext context = connectionFactory.createContext()) {
// Create the queue programmatically and the corresponding router resource
Queue queue = context.createQueue(QUEUE_NAME);