Reputation: 259
One of my projects requires authentication for using RabbitMQ. Only authenticated users can connect to the rabbitmq server and subscribe to queues etc. For example, when a user connects to the server for the first time and sends some auth data (like login, password) - server should check it and, if the user passed authentication, he will be able to subscribe to queues etc. Otherwise, the server would disconnect the user. Is there a solution for this?
Please don't judge too harshly, I'm not really familiar with RabbitMQ and stuff like this.
Upvotes: 9
Views: 15068
Reputation: 511
This amqplib documentation gives a straightforward answer.
Connecting with an object instead of a URL
The URL can also be supplied as an object of the form:
{
protocol: 'amqp',
hostname: 'localhost',
port: 5672,
username: 'guest',
password: 'guest',
locale: 'en_US',
frameMax: 0,
heartbeat: 0,
vhost: '/',
}
Upvotes: 0
Reputation: 19295
This is very easy to find out yourself. A simple Google search for the terms, "RabbitMQ Authentication" returns this page as the first entry:
When an AMQP client establishes a connection to an AMQP server, it specifies a virtual host within which it intends to operate. A first level of access control is enforced at this point, with the server checking whether the user has any permissions to access the virtual hosts, and rejecting the connection attempt otherwise.
Upvotes: 16