ejabberd-python-extauth is a simple python script to be used for external authentication in ejabberd. The script can be used to authenticate against a JSON API that processes the authentication requests of ejabberd.
The script probably cannot be used as-it-is but may serve as a starting point if you intent to create your own external authentication script for ejabberd.
- python < 3
- JSON API
In order to use ejabberd-python-extauth you have to edit the
ejabberd configuration in your ejabberd.cfg
:
{auth_method, external}.
{extauth_program, "python /path/to/auth.py http://base.url/auth/"}.
The authentication script accepts a few configuration arguments:
$ ./auth.py -h
usage: auth.py [-h] [-l LOG] [-d] [URL]
ejabberd authentication script
positional arguments:
URL base URL (default: http://localhost:8000/auth/)
optional arguments:
-h, --help show this help message and exit
-l LOG, --log LOG log directory (default: /var/log/ejabberd)
-d, --debug toggle debug mode
The examplary JSON API used in the script expects the following API endpoints. As described earlier the JSON calls are supposed to be an example for your own API.
POST BASE_URL/login
{ "username": "user@domain", "password": "***" }
POST BASE_URL/exists
{ "username": "user@domain" }