Skip to content

Commit 8d8403c

Browse files
auth_backend_http: modernize the README
(cherry picked from commit ddda1bb)
1 parent 01b0c6c commit 8d8403c

File tree

1 file changed

+74
-83
lines changed

1 file changed

+74
-83
lines changed

deps/rabbitmq_auth_backend_http/README.md

Lines changed: 74 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -9,42 +9,32 @@ This plugin can put a significant amount of load on its backing service.
99
We recommend using it together with [rabbitmq_auth_backend_cache](http://github.com/rabbitmq/rabbitmq-auth-backend-cache)
1010
with a reasonable caching interval (e.g. 1-3 minutes).
1111

12-
13-
## Project Maturity
14-
15-
As of 3.7.0, this plugin is distributed with RabbitMQ.
16-
17-
1812
## RabbitMQ Version Requirements
1913

20-
As of 3.7.0, this plugin is distributed with RabbitMQ.
21-
22-
As with all [authentication plugins](http://rabbitmq.com/access-control.html), this one requires RabbitMQ server
23-
2.3.1 or later.
24-
25-
## Using with RabbitMQ 3.6.x
26-
27-
Install the corresponding .ez files from our
28-
[Community Plugins page](http://www.rabbitmq.com/community-plugins.html). Note that different
29-
releases of this plugin support different versions of RabbitMQ.
14+
This plugin is distributed with RabbitMQ.
3015

3116
## Enabling the Plugin
3217

33-
First enable the plugin using `rabbitmq-plugins`:
34-
35-
rabbitmq-plugins enable rabbitmq_auth_backend_http
18+
Like all RabbitMQ plugins, this plugin must be enabled before it can be used:
3619

20+
``` shell
21+
rabbitmq-plugins enable rabbitmq_auth_backend_http
22+
```
3723

3824
## Configuring the Plugin
3925

4026
To use this backend exclusively, use the following snippet in `rabbitmq.conf` (currently
4127
in master)
4228

43-
auth_backends.1 = http
29+
``` ini
30+
auth_backends.1 = http
31+
```
4432

4533
Or, in the classic config format (`rabbitmq.config`, prior to 3.7.0) or `advanced.config`:
4634

47-
[{rabbit, [{auth_backends, [rabbit_auth_backend_http]}]}].
35+
``` erl
36+
[{rabbit, [{auth_backends, [rabbit_auth_backend_http]}]}].
37+
```
4838

4939
See [RabbitMQ Configuration guide](http://www.rabbitmq.com/configure.html) and
5040
[Access Control guide](http://rabbitmq.com/access-control.html) for more information.
@@ -56,24 +46,28 @@ Below is a minimal configuration file example.
5646

5747
In `rabbitmq.conf`:
5848

59-
auth_backends.1 = http
60-
auth_http.http_method = post
61-
auth_http.user_path = http://some-server/auth/user
62-
auth_http.vhost_path = http://some-server/auth/vhost
63-
auth_http.resource_path = http://some-server/auth/resource
64-
auth_http.topic_path = http://some-server/auth/topic
65-
66-
In the [classic config format](http://www.rabbitmq.com/configure.html) (`rabbitmq.config` prior to 3.7.0 or `advanced.config`):
67-
68-
[
69-
{rabbit, [{auth_backends, [rabbit_auth_backend_http]}]},
70-
{rabbitmq_auth_backend_http,
71-
[{http_method, post},
72-
{user_path, "http(s)://some-server/auth/user"},
73-
{vhost_path, "http(s)://some-server/auth/vhost"},
74-
{resource_path, "http(s)://some-server/auth/resource"},
75-
{topic_path, "http(s)://some-server/auth/topic"}]}
76-
].
49+
``` ini
50+
auth_backends.1 = http
51+
auth_http.http_method = post
52+
auth_http.user_path = http://some-server/auth/user
53+
auth_http.vhost_path = http://some-server/auth/vhost
54+
auth_http.resource_path = http://some-server/auth/resource
55+
auth_http.topic_path = http://some-server/auth/topic
56+
```
57+
58+
In the [`advanced.config` format](https://www.rabbitmq.com/configure.html#advanced-config-file):
59+
60+
``` erl
61+
[
62+
{rabbit, [{auth_backends, [rabbit_auth_backend_http]}]},
63+
{rabbitmq_auth_backend_http,
64+
[{http_method, post},
65+
{user_path, "http(s)://some-server/auth/user"},
66+
{vhost_path, "http(s)://some-server/auth/vhost"},
67+
{resource_path, "http(s)://some-server/auth/resource"},
68+
{topic_path, "http(s)://some-server/auth/topic"}]}
69+
].
70+
```
7771

7872
By default `http_method` configuration is `GET` for backwards compatibility. It's recommended
7973
to use `POST` requests to avoid credentials logging.
@@ -87,33 +81,33 @@ against the URIs listed in the configuration file. It will add query string
8781

8882
### user_path
8983

90-
* `username` - the name of the user
91-
* `password` - the password provided (may be missing if e.g. rabbitmq-auth-mechanism-ssl is used)
84+
* `username`: the name of the user
85+
* `password`: the password provided (may be missing if e.g. rabbitmq-auth-mechanism-ssl is used)
9286

9387
### vhost_path
9488

95-
* `username` - the name of the user
96-
* `vhost` - the name of the virtual host being accessed
97-
* `ip` - the client ip address
89+
* `username`: the name of the user
90+
* `vhost`: the name of the virtual host being accessed
91+
* `ip`: the client ip address
9892

9993
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.
10094

10195
### resource_path
10296

103-
* `username` - the name of the user
104-
* `vhost` - the name of the virtual host containing the resource
105-
* `resource` - the type of resource (`exchange`, `queue`, `topic`)
106-
* `name` - the name of the resource
107-
* `permission` - the access level to the resource (`configure`, `write`, `read`) - see [the Access Control guide](http://www.rabbitmq.com/access-control.html) for their meaning
97+
* `username`: the name of the user
98+
* `vhost`: the name of the virtual host containing the resource
99+
* `resource`: the type of resource (`exchange`, `queue`, `topic`)
100+
* `name`: the name of the resource
101+
* `permission`:the access level to the resource (`configure`, `write`, `read`): see [the Access Control guide](http://www.rabbitmq.com/access-control.html) for their meaning
108102

109103
### topic_path
110104

111-
* `username` - the name of the user
112-
* `vhost` - the name of the virtual host containing the resource
113-
* `resource` - the type of resource (`topic` in this case)
114-
* `name` - the name of the exchange
115-
* `permission` - the access level to the resource (`write` or `read`)
116-
* `routing_key` - the routing key of a published message (when the permission is `write`)
105+
* `username`: the name of the user
106+
* `vhost`: the name of the virtual host containing the resource
107+
* `resource`: the type of resource (`topic` in this case)
108+
* `name`: the name of the exchange
109+
* `permission`: the access level to the resource (`write` or `read`)
110+
* `routing_key`: the routing key of a published message (when the permission is `write`)
117111
or routing key of the queue binding (when the permission is `read`)
118112

119113
See [topic authorisation](http://www.rabbitmq.com/access-control.html#topic-authorisation) for more information
@@ -122,54 +116,51 @@ about topic authorisation.
122116
Your web server should always return HTTP 200 OK, with a body
123117
containing:
124118

125-
* `deny` - deny access to the user / vhost / resource
126-
* `allow` - allow access to the user / vhost / resource
127-
* `allow [list of tags]` - (for `user_path` only) - allow access, and mark the user as an having the tags listed
119+
* `deny`: deny access to the user / vhost / resource
120+
* `allow`: allow access to the user / vhost / resource
121+
* `allow [list of tags]` (for `user_path` only): allow access, and mark the user as an having the tags listed
128122

129123
## Using TLS/HTTPS
130124

131125
If your Web server uses HTTPS and certificate verification, you need to
132126
configure the plugin to use a CA and client certificate/key pair using the `rabbitmq_auth_backend_http.ssl_options` config variable:
133127

134-
[
135-
{rabbit, [{auth_backends, [rabbit_auth_backend_http]}]},
136-
{rabbitmq_auth_backend_http,
137-
[{http_method, post},
138-
{user_path, "https://some-server/auth/user"},
139-
{vhost_path, "https://some-server/auth/vhost"},
140-
{resource_path, "https://some-server/auth/resource"},
141-
{topic_path, "https://some-server/auth/topic"},
142-
{ssl_options,
143-
[{cacertfile, "/path/to/cacert.pem"},
144-
{certfile, "/path/to/client/cert.pem"},
145-
{keyfile, "/path/to/client/key.pem"},
146-
{verify, verify_peer},
147-
{fail_if_no_peer_cert, true}]}]}
148-
].
128+
``` erl
129+
[
130+
{rabbit, [{auth_backends, [rabbit_auth_backend_http]}]},
131+
{rabbitmq_auth_backend_http,
132+
[{http_method, post},
133+
{user_path, "https://some-server/auth/user"},
134+
{vhost_path, "https://some-server/auth/vhost"},
135+
{resource_path, "https://some-server/auth/resource"},
136+
{topic_path, "https://some-server/auth/topic"},
137+
{ssl_options,
138+
[{cacertfile, "/path/to/cacert.pem"},
139+
{certfile, "/path/to/client/cert.pem"},
140+
{keyfile, "/path/to/client/key.pem"},
141+
{verify, verify_peer},
142+
{fail_if_no_peer_cert, true}]}]}
143+
].
144+
```
149145

150146
It is recommended to use TLS for authentication and enable peer verification.
151147

152148
### Wildcard Certificates
153149

154150
If the certificate of your Web Server should be matched against a wildcard certificate in your `cacertfile`, the following option must be added to the `ssl_options`:
155151

156-
{customize_hostname_check, [{match_fun,public_key:pkix_verify_hostname_match_fun(https)}]}
152+
``` erl
153+
{customize_hostname_check, [{match_fun,public_key:pkix_verify_hostname_match_fun(https)}]}
154+
```
157155

158156
## Debugging
159157

160-
Check the RabbitMQ logs if things don't seem to be working
161-
properly. Look for log messages containing "rabbit_auth_backend_http
158+
[Enable debug logging](https://rabbitmq.com/logging.html#debug-logging) to see what the backend service receives.
159+
Look for log messages containing "rabbit_auth_backend_http
162160
failed".
163161

164162
## Example Apps
165163

166164
There are [example backend services](./examples) available in Python, PHP, Spring Boot, ASP.NET Web API.
167165

168166
See [examples README](./examples/README.md) for more information.
169-
170-
## Building from Source
171-
172-
You can build and install it like any other plugin (see
173-
[the plugin development guide](http://www.rabbitmq.com/plugin-development.html)).
174-
175-
This plugin depends on the Erlang client (just to grab a URI parser).

0 commit comments

Comments
 (0)