/vernemq_demo_plugin

A VerneMQ plugin demonstrating the authentication and authorization hooks.

Primary LanguageErlang

VerneMQ Demo Plugin

This plugin demonstrates how you can develop an Authentication/Authorization plugin for VerneMQ. The important files are:

  • src/vernemq_demo_plugin.erl
  • src/vernemq_demo_plugin.app.src

The rest is the Erlang OTP application boilerplate.

You must have a recent version of Erlang installed (it's recommended to use the same one VerneMQ is compiled for, typically > 17). To compile do:

./rebar3 compile

Then enable the plugin using:

vmq-admin plugin enable --name vernemq_demo_plugin --path <PathToYourPlugin>/vernemq_demo_plugin/_build/default

Depending on how VerneMQ is started you might need sudo rights to access vmq-admin. Moreover the <PathToYourPlugin> should be accessible by VerneMQ (file permissions).

Since this demo plugin implements hooks which are already covered by vmq_passwd and vmq_acl you might want to disable these in order to see the effect of this plugin.

vmq-admin plugin disable --name vmq_passwd
vmq-admin plugin disable --name vmq_acl

That's it!