2017-02-14 23:51:47 +08:00
|
|
|
# RabbitMQ HTTP Authn/Authz Backend Examples
|
|
|
|
|
2017-02-16 21:04:27 +08:00
|
|
|
## Python Example
|
2017-01-12 20:06:32 +08:00
|
|
|
|
|
|
|
`rabbitmq_auth_backend_django` is a very minimalistic [Django](https://www.djangoproject.com/) 1.10+ application
|
|
|
|
that rabbitmq-auth-backend-http can authenticate against. It's really
|
|
|
|
not designed to be anything other than an example.
|
|
|
|
|
2017-02-14 23:51:47 +08:00
|
|
|
### Running the Example
|
2017-01-12 20:06:32 +08:00
|
|
|
|
|
|
|
Run `start.sh` to launch it after [installing Django](https://docs.djangoproject.com/en/1.10/topics/install/). You may need to
|
|
|
|
hack `start.sh` if you are not running Debian or Ubuntu.
|
|
|
|
|
|
|
|
The app will use a local SQLite database. It uses the standard
|
|
|
|
Django authentication database. All users get access to all vhosts and
|
|
|
|
resources.
|
|
|
|
|
2017-02-14 23:51:47 +08:00
|
|
|
### HTTP Endpoint Examples
|
2017-01-12 20:06:32 +08:00
|
|
|
|
|
|
|
If you're not familiar with Django, urls.py and auth/views.py may be
|
|
|
|
most illuminating.
|
2017-02-14 23:51:47 +08:00
|
|
|
|
2017-02-16 21:04:27 +08:00
|
|
|
|
|
|
|
## Spring Boot Example
|
2017-02-14 23:51:47 +08:00
|
|
|
|
|
|
|
`rabbitmq_auth_backend_spring_boot` is a simple [Spring Boot](https://projects.spring.io/spring-boot/)
|
|
|
|
application that rabbitmq-auth-backend-http can authenticate against. It's really
|
|
|
|
not designed to be anything other than an example.
|
|
|
|
|
|
|
|
## Running the Example
|
|
|
|
|
|
|
|
Import the example as a Maven project in your favorite IDE or run it directly from the command line:
|
|
|
|
|
|
|
|
mvn spring-boot:run
|
|
|
|
|
|
|
|
The application listens on the 8080 port.
|
|
|
|
|
|
|
|
### HTTP Endpoint Examples
|
|
|
|
|
|
|
|
Have a look at the `AuthBackendHttpController`. There's only one user: `guest`,
|
|
|
|
with the `guest` password. This implementation also checks the
|
2017-02-16 21:04:27 +08:00
|
|
|
routing key starts with an `a` when publishing to a topic exchange
|
|
|
|
or consuming from a topic. (an example of [topic authorisation](http://next.rabbitmq.com/access-control.html#topic-authorisation)).
|