2011-03-25 19:18:40 +08:00
# Overview
This plugin provides the ability for your RabbitMQ server to perform
authentication (determining who can log in) and authorisation
(determining what permissions they have) by making requests to an HTTP
server.
2011-03-26 21:04:22 +08:00
As with all authentication plugins, this one requires rabbitmq-server
2.3.1 or later.
2011-03-25 19:18:40 +08:00
Note: it's at an early stage of development, although it's
conceptually very simple.
2014-04-10 21:33:30 +08:00
# Downloading
You can download a pre-built binary of this plugin from
http://www.rabbitmq.com/community-plugins.html.
# Building
2011-03-25 19:18:40 +08:00
You can build and install it like any other plugin (see
[the plugin development guide ](http://www.rabbitmq.com/plugin-development.html )).
2013-01-16 19:30:48 +08:00
This plugin depends on the Erlang client (just to grab a URI parser).
2011-03-25 19:36:41 +08:00
2011-03-25 19:18:40 +08:00
# Enabling the plugin
To enable the plugin, set the value of the `auth_backends` configuration item
for the `rabbit` application to include `rabbit_auth_backend_http` .
`auth_backends` is a list of authentication providers to try in order.
So a configuration fragment that enables this plugin *only* would look like:
[{rabbit, [{auth_backends, [rabbit_auth_backend_http]}]}].
to use only HTTP, or:
[{rabbit,
[{auth_backends, [rabbit_auth_backend_http, rabbit_auth_backend_internal]}]
}].
2014-06-12 23:37:25 +08:00
to try the HTTP plugin first and then fall back to the internal database.
See http://www.rabbitmq.com/configure.html#configuration-file for more detail
on `auth_backends` .
2011-03-25 19:18:40 +08:00
# Configuring the plugin
You need to configure the plugin to know which URIs to point at.
A minimal configuration file might look like:
[
{rabbit, [{auth_backends, [rabbit_auth_backend_http]}]},
2011-04-15 22:44:39 +08:00
{rabbitmq_auth_backend_http,
2011-03-25 19:18:40 +08:00
[{user_path, "http://some-server/auth/user"},
{vhost_path, "http://some-server/auth/vhost"},
{resource_path, "http://some-server/auth/resource"}]}
].
# What must my web server do?
2011-03-25 19:33:28 +08:00
This plugin requires that your web server respond to requests in a
certain predefined format. It will make GET requests against the URIs
listed in the configuration file. It will add query string parameters
as follows:
2011-03-25 19:18:40 +08:00
### user_path
* `username` - the name of the user
* `password` - the password provided (may be missing if e.g. rabbitmq-auth-mechanism-ssl is used)
### vhost_path
* `username` - the name of the user
* `vhost` - the name of the virtual host being accessed
2011-04-05 00:35:48 +08:00
Note that you cannot create arbitrary virtual hosts using this plugin; you can only determine whether your users can see / access the ones that exist.
2011-03-25 19:18:40 +08:00
### resource_path
* `username` - the name of the user
* `vhost` - the name of the virtual host containing the resource
* `resource` - the type of resource (`exchange`, `queue` )
* `name` - the name of the resource
2011-12-01 19:36:42 +08:00
* `permission` - the access level to the resource (`configure`, `write` , `read` ) - see [the admin guide ](http://www.rabbitmq.com/access-control.html ) for their meaning
2011-03-25 19:18:40 +08:00
Your web server should always return HTTP 200 OK, with a body
2011-12-01 19:36:42 +08:00
containing:
2011-03-25 19:18:40 +08:00
* `deny` - deny access to the user / vhost / resource
* `allow` - allow access to the user / vhost / resource
2011-12-01 19:36:42 +08:00
* `allow [list of tags]` - (for `user_path` only) - allow access, and mark the user as an having the tags listed
2011-03-25 19:18:40 +08:00
# Debugging
2011-03-25 19:33:28 +08:00
Check the RabbitMQ logs if things don't seem to be working
properly. Look for log messages containing "rabbit_auth_backend_http
failed".
2011-03-25 19:18:40 +08:00
# Example
2011-03-25 19:28:37 +08:00
In `examples/rabbitmq_auth_backend_django` there's a very simple
Django app that can be used for authentication. On Debian / Ubuntu you
should be able to run start.sh to launch it after installing the
python-django package. It's really not designed to be anything other
than an example.
2011-03-25 19:18:40 +08:00
See `examples/README` for slightly more information.