RabbitMQ 和授权

发布于 2024-12-21 10:33:03 字数 200 浏览 3 评论 0原文

我的一个项目需要进行身份验证才能使用 RabbitMQ。只有经过身份验证的用户才能连接到rabbitmq服务器并订阅队列等。例如,当用户第一次连接到服务器并发送一些身份验证数据(如登录名、密码)时,服务器应该检查它,如果用户通过身份验证后,他将能够订阅队列等。否则,服务器将断开用户的连接。有解决办法吗?

请不要太严厉地评判,我对 RabbitMQ 之类的东西不太熟悉。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

再见回来 2024-12-28 10:33:03

这个你自己很容易发现。对术语“RabbitMQ Authentication”进行简单的 Google 搜索会返回此页面作为第一个条目:

当 AMQP 客户端与 AMQP 服务器建立连接时,它
指定要在其中运行的虚拟主机。第一个
此时,服务器将强制执行访问控制级别
检查用户是否有访问虚拟机的权限
主机,否则拒绝连接尝试。

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.

你列表最软的妹 2024-12-28 10:33:03

这个 amqplib 文档给出了一个简单的答案。

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: '/',
}

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: '/',
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文