RabbitMQ authorisation Backend for Cloud Foundry UAA
Allows to use access tokens provided by CF UAA to authorize in RabbitMQ.
Make requests to /check_token endpoint on UAA server. See https://github.com/cloudfoundry/uaa/blob/master/docs/UAA-APIs.rst#id32
First, enable the plugin. Then, configure access to UAA:
{rabbitmq_auth_backend_uaa,
[{uri, <<"https://your-uaa-server">>},
{username, <<"uaa-client-id">>},
{password, <<"uaa-client-secret">>},
{resource_server_id, <<"your-resource-server-id"}]}
where
your-uaa-serveris a UAA server hostuaa-client-idis a UAA client IDuaa-client-secretis the shared secretyour-resource-server-idis a resource server ID (e.g. 'rabbitmq')
To learn more about UAA/OAuth 2 clients, see UAA docs.
Then you can use access_tokens acquired from UAA as username to authenticate in RabbitMQ.
Scopes are translated into permission grants to RabbitMQ resources for the provided token.
The current scope format is <permission>:<vhost_pattern>/<name_pattern>[/<routing_key_pattern>] where
<permission>is an access permission (configure,read, orwrite)<vhost_pattern>is a wildcard pattern for vhosts, token has acces to.<name_pattern>is a wildcard pattern for resource name<routing_key_pattern>is an optional wildcard pattern for routing key in topic authorization
Wildcard patterns are strings with optional wildcard symbols * that match
any sequence of characters.
Wildcard patterns match as wollowing:
*matches any stringfoo*matches any string starting with afoo*foomatches any string ending with afoofoo*barmatches any string starting with afooand ending with abar
There can be multiple wildcards in a pattern:
start*middle*end*before*after*
If you want to use special characters like *, %, or / in a wildacrd pattern,
the pattern must be URL-encoded.
See the [./test/wildcard_match_SUITE.erl](wildcard matching test suite) for more examples.
- There should be application client registered on UAA server.
- Client id and secret should be set in plugin env as
usernameandpassword - Client authorities should include
uaa.resource - RabbitMQ auth_backends should include
rabbit_auth_backend_uaa
- Client authorize with UAA, requesting
access_token(using any grant type) - Token scope should contain RabbitMQ resource scopes (e.g.
configure:%2F/foomeans "configure queue 'foo' in vhost '/'") - Client passes token for a username when connecting to a RabbitMQ node