emqttd Authentication with MongoDB
File: etc/plugin.config
[
{emqttd_auth_mongodb, [
{database, "db0"},
{collection, "mqtt_user"},
{password_hash, sha256},
]}
].
use db0
db.createCollection("mqtt_user")
db.mqtt_user.ensureIndex({"username":1})
{
"username" : "1000",
"password" : "8d969eef6ecad3c29a3a629280e686cf0c3f5d5a86aff3ca12020c923adc6c92",
"sale" : 0,
"created" : 0
}
This project is a plugin for emqttd broker. In emqttd project:
If the submodule exists:
git submodule update --remote
Orelse:
git submodule add https://github.com/emqtt/emqtt_mongodb.git plugins/emqtt_mongodb
make && make dist
./bin/emqttd_ctl plugins load emqttd_mongodb