Skip to content

Support Oauth2 authentication for AMQP connection #140

@pk-work

Description

@pk-work

Describe the feature

I want to connect to an AMQP Broker which is secured with OAuth2.

When I'm using Qpid (Proton?) [1] directly, I can connect to that Broker with the following code:

    String hostUri= "amqps://<myBrokerUrl>:5671?amqp.saslMechanisms=XOAUTH2";
    String username = oauthClientId;
    String password= oauthBearerToken;
    JmsConnectionFactory connectionFactory = new JmsConnectionFactory(username, password, hostUri);

With Vert.x Proton I cannot pass a hostUri like this, there I have to configure the connection like this:

    ProtonClient client = ProtonClient.create(vertx);
    ProtonClientOptions opts = new ProtonClientOptions();
    opts.addEnabledSaslMechanism("XOAUTH2");

    // Connect, then use the event loop thread to process things thereafter
    client.connect(opts, "<myBrokerUrl>", 5671, oauthClientId, token, connectResult -> {
       ...
    }

But this is not working. it just says "DISCONNECT". When I turn SSL on with opts.setSSL(true) I get the error Could not find a suitable SASL mechanism for the remote peer using the available credentials.

Can we support OAuth2 authentication, or how can I use it in case it is already supported. Due to the fact that Qpid itself supports it already, it hopefully is not that much effort.

[1] https://mvnrepository.com/artifact/org.apache.qpid/qpid-jms-client/2.7.0

Contribution

Sorry I'm limited at the moment and put all my efforts in vertx-openapi.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions