简体   繁体   English

如何实现MQTT Broker端授权?

[英]How to implement MQTT Broker side Authorization?

I have an MQTT broker where devices are connecting to it and publishing data to the broker and I have a nodejs program that helps clients, subscribe to the topic, and receive the data they are publishing through their device.我有一个 MQTT 代理,其中设备连接到它并将数据发布到代理,我有一个 nodejs 程序可以帮助客户、订阅主题并接收他们通过他们的设备发布的数据。

Now my use case is to provide each client with a unique token which they have to send while connecting the MQTT broker in order to start publishing the data.现在我的用例是为每个客户端提供一个唯一的令牌,他们必须在连接 MQTT 代理时发送该令牌才能开始发布数据。 And I want to validate that client token using an API and then establish a connection between the client and MQTT Broker.我想使用 API 验证该客户端令牌,然后在客户端和 MQTT Broker 之间建立连接。

I have searched for my use case but I have not found any help.我已经搜索了我的用例,但没有找到任何帮助。

Mosquitto has an authorisation plugin API that will let you build your authentication scheme. Mosquitto 有一个授权插件 API,可让您构建身份验证方案。

The doc for the API is here API 的文档在这里

You can also search GitHub for existing auth plugins eg https://github.com/jpmens/mosquitto-auth-plug (this plugin is no longer being developed but there are active forks)您还可以在 GitHub 上搜索现有的 auth 插件,例如https://github.com/jpmens/mosquitto-auth-plug (此插件不再开发,但有活跃的分叉)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM