-
Notifications
You must be signed in to change notification settings - Fork 4k
Description
Is your feature request related to a problem? Please describe.
This is a feature requested to support the following scenarios:
- Users connect to RabbitMQ with tokens issued by more than one Authorization Server using the same
audiencevalue. Currently, this is supported provided you manually configure the corresponding signing keys used by each Authorization Server. However, very seldomly users wants to do that and instead prefer to configure thejwks_urlso that RabbitMQ downloads the signing key directly from the url. Today, it is not possible to configure more than one url. - Users connect to RabbitMQ with tokens issued by more than one Authorization Server where server uses a different
audiencevalue. Currently, RabbitMQ only supports one singleresource_server_idvalue which means theaudiencehas to match that single value. - Same as the previous scenario except that in multi-tenant Authorization servers, each tenant behaves like a separate Authorization server. Furthermore, each server refers to RabbitMQ with a different
audiencevalue. The difference with regards the previous scenario is that in this one the provider_url is the same. The only thing that changes is the resource_id value.
So that you get an idea of what this feature provides, users may be authenticated against Keycloak, UAA and Oauth0 on the same RabbitMQ cluster.
Describe the solution you'd like
To keep backward compatibility, the solution proposes new settings while keeping the existing ones.
The solution affects two plugins: rabbitmq-auth-backend-oauth2 and rabbitmq-management.
Example configuration of rabbitmq-auth-backend-oauth2 plugin:
# Sets common settings for all resource server(s)
auth_oauth2.scope_prefix = api://
auth_oauth2.additional_scopes_key = role
auth_oauth2.preferred_username_claims = username
# Configure RabbitMQ as an OAuth2 resource with the id "rabbitmq-for-operations" and with its jwks_uri
auth_oauth2.resource_servers.1.id = rabbitmq-for-operations
auth_oauth2.resource_servers.1.verify_aud = false
auth_oauth2.resource_servers.1.jwks_uri = https://some-uri.operations
auth_oauth2.resource_servers.2.id = rabbitmq-for-business
auth_oauth2.resource_servers.2.jwks_uri = https://some-uri.businessIf a resource_server like rabbitmq-for-business does not configure a setting like scope_prefix, it inherits from the auth_oauth2.scope_prefix setting or else from the default scope_prefix value.
If the configuration presents several auth_oauth2.resource_servers.<> ids in addition to the auth_oauth2.resource_server_id one, RabbitMQ ignores the latter.
Example configuration of rabbitmq-management plugin:
management.oauth_enabled = true
management.oauth_scopes = ....
management.resource_servers.1.id = rabbitmq-for-operations
management.resource_servers.1.label = Operations
management.resource_servers.1.client_id = client-ops
management.resource_servers.1.scopes = ....
management.resource_servers.1.provider_url = https://....
management.resource_servers.2.id = rabbitmq-for-custoners
management.resource_servers.2.client_id = client-cust
management.resource_servers.2.provider_url = https://....
management.resource_servers.2.initiated_logon_type = idp_initiatedWith the above configuration, RabbitMQ users who come to management ui are presented with the typical SSO page with a drop-down with the label "Choose OAuth resource" and with the following options:
- Operations
- rabbitmq-for-customers
The list is built using the
labelattribute if present, else it uses theidattribute or else the index itself, e.g.1or2in the above example.
When they click on the button, they are redirected to the authorization server configured for the resource using the corresponding client_id and provider_url.
What happens with the existing oauth_ settings besides oauth_enabled ? With the above configuration, the existing oauth_ settings like oauth_scopes are used as default values. For instance, the rabbitmq-for-custoners resource does not specify scopes field. The default value is taken from management.oauth_scopes.
Is it possible to support basic auth and oauth2 authentication in the management ui? Today it is not possible. With this solution it would be possible as long as management.disable_basic_auth is false. One of the options presented in the drop-down box is:
- Basic authentication