Skip to content

Commit d13f6b9

Browse files
Merge pull request #2084 from rabbitmq/deprecate-oauth2-settings
4.1: Deprecate two OAuth 2 settings
2 parents 19e677c + 6373392 commit d13f6b9

File tree

8 files changed

+150
-142
lines changed

8 files changed

+150
-142
lines changed

docs/management/index.md

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -410,8 +410,13 @@ Given above configuration, when a user visits the management UI, the following t
410410
If RabbitMQ cannot download the OpenID provider configuration, it shows an error message and the OAuth 2.0 authentication option will be disabled in the management UI
411411
:::
412412

413+
:::warning
414+
`management.oauth_metadata_url` and `management.oauth_resource_servers.$id.oauth_metadata_url` are deprecated. You should configure the OpenId Discovery endpoint's path as it is explained [here](./oauth2#discovery-endpoint-params).
415+
These two settings will no longer exist in RabbitMQ 4.2.0. In the meantime, RabbitMQ will support them until you update your configuration.
416+
:::
417+
413418
:::tip
414-
If you used to configure `management.oauth_metadata_url` because your provider did not use the standard OpenId Discovery endpoint's path, since RabbitMQ 4.1 you should instead configure the correct path as it is explained [here](./oauth2#discovery-endpoint-params).
419+
If you used to configure `auth_oauth2.metadata_url` because your provider used a slightly different OpenId Discovery endpoint url, since RabbitMQ 4.1 you should instead configure the correct path and/or include any additional parameters. Please read [this section of the documentation](./oauth2#discovery-endpoint-params) where it is explained how to do it. `auth_oauth2.metadata_url` may be deprecated in future versions.
415420
:::
416421

417422
2. RabbitMQ displays a button with the label "Click here to login". When the user clicks on the button, the management UI initiates the OAuth 2.0 Authorization Code Flow, which redirects the user to the identity provider to authenticate and get a token.
@@ -510,29 +515,18 @@ RabbitMQ 3.13.1 and earlier versions require the [OpenId Connect Discovery endpo
510515
There are other two additional scenarios which can trigger a logout. One scenario occurs when the OAuth Token expires. Although RabbitMQ renews the token in the background before it expires, if the token expires, the user is logged out.
511516
The second scenario is when the management UI session exceeds the maximum allowed time configured on the [Login Session Timeout](#login-session-timeout).
512517

513-
### Configure Extra URI Parameters for Authorization and Token Endpoints {#extra-endpoint-params}
518+
### Configure extra parameters for authorization and token endpoints {#extra-endpoint-params}
514519

515-
Some OAuth 2.0 providers require additional URI parameters to be included into the request sent to the **authorization endpoint** and/or to the **token endpoint**.
516-
These parameters are vendor- or IDP installation-specific. The Management UI already sends all the parameters required by the OAuth 2.0 Authorization Code flow.
520+
There are some OAuth 2.0 providers which require extra parameters in the request sent to the **authorization endpoint** and/or to the **token endpoint**. These parameters are custom parameters. The Management UI already sends all the parameters required by the OAuth 2.0 Authorization Code flow.
517521

518-
In the followingexample an extra URI parameter called `audience` is added for both the **authorization** and **token** endpoints:
522+
Here is an example of setting an extra parameter called `audience` for both endpoints, the **authorization** and **token** endpoint:
519523

520524
```ini
521525
management.oauth_authorization_endpoint_params.audience = some-audience-id
522-
523-
management.oauth_token_endpoint_params.audience = some-audience-id
524-
```
525-
526-
Multiple parameters can be configured like so:
527-
528-
```ini
529-
management.oauth_authorization_endpoint_params.audience = some-audience-id
530-
management.oauth_authorization_endpoint_params.example = example-value
531-
532526
management.oauth_token_endpoint_params.audience = some-audience-id
533-
management.oauth_token_endpoint_params.other = other-value
534527
```
535528

529+
You can configure as many parameters as you need.
536530

537531
### Special attention to CSP header `connect-src` {#csp-header}
538532

@@ -629,12 +623,11 @@ the following settings:
629623
- `resource` : `rabbit_prod`
630624
- `scopes` : `openid rabbitmq.tag:management rabbitmq.read:*/*`
631625

632-
### Configure Extra URI Parameters for Authorization and Token Endpoints {#extra-endpoint-params}
626+
#### Configure extra parameters for authorization and token endpoints
633627

634-
Some OAuth 2.0 providers require additional URI parameters to be included into the request sent to the **authorization endpoint** and/or to the **token endpoint**.
635-
These parameters are vendor- or IDP installation-specific. The Management UI already sends all the parameters required by the OAuth 2.0 Authorization Code flow.
628+
There are some OAuth 2.0 providers which require extra parameters in the request sent to the **authorization endpoint** and/or to the **token endpoint**. These parameters are custom parameters and specified per resource. The Management UI already sends all the parameters required by the OAuth 2.0 Authorization Code flow.
636629

637-
The following example sets an extra URI parameter called `audience` for both endpoints for the resource `some-resource-id`:
630+
Here is an example of setting an extra parameter called `audience` for both endpoints for the resource `some-resource-id`:
638631

639632
```ini
640633
management.oauth_resource_servers.2.id = some-resource-id

docs/oauth2-examples-auth0.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,7 @@ To configure RabbitMQ you need to gather the following information from Auth0:
9999
4. And take note of the *Domain* value
100100
5. Use the last values in *Client ID* and *Domain* fields in the RabbitMQ configuration file
101101

102-
Copy [conf/auth0/rabbitmq.conf.tmpl](https://github.com/rabbitmq/rabbitmq-oauth2-tutorial/blob/main/conf/auth0/rabbitmq.conf.tmpl) as `rabbitmq.conf`.
103-
It must be in same folder as `rabbitmq.conf.tmpl`.
102+
Clone the configuration file [conf/auth0/rabbitmq.conf.tmpl](https://github.com/rabbitmq/rabbitmq-oauth2-tutorial/blob/main/conf/auth0/rabbitmq.conf.tmpl) as `rabbitmq.conf` (in the same folder as `rabbitmq.conf.tmpl`).
104103

105104
Edit `rabbitmq.conf` and proceed as follows:
106105

docs/oauth2-examples-entra-id/index.md

Lines changed: 42 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,14 @@ limitations under the License.
2424
This guide explains how to set up OAuth 2.0 for RabbitMQ
2525
and Microsoft Entra ID as Authorization Server using the following flows:
2626

27-
* Access the management UI via a browser using v2.0 api version
28-
27+
* Access the management UI via a browser using Entra ID (API version 2.0)
2928

3029
## Prerequisites to follow this guide
3130

32-
* Have an account in https://portal.azure.com.
31+
* Have an [Azure account](https://portal.azure.com.)
3332
* Docker
34-
* Openssl
35-
* A local clone of a [GitHub repository](https://github.com/rabbitmq/rabbitmq-oauth2-tutorial/tree/next) for branch `next` that contains all the configuration files and scripts used on this example.
33+
* OpenSSL
34+
* A local clone of a [GitHub repository](https://github.com/rabbitmq/rabbitmq-oauth2-tutorial/tree/next) (the `next` branch) that contains all the configuration files and scripts used on this example.
3635

3736
## Register your app
3837

@@ -62,12 +61,12 @@ When using **Entra ID as OAuth 2.0 server**, your client app (in our case Rabbit
6261

6362
5. Click on **Register**.
6463

65-
![Entra ID OAuth 2.0 App](./entra-id-oauth-registered-app.png)
64+
![Entra ID OAuth 2.0 App](./entra-id-oauth-registered-app.png)
6665

67-
Note the following values, as you will need it later to configure the `rabbitmq_auth_backend_oauth2` on RabbitMQ side:
66+
Note the following values, as you will need it later to configure the `rabbitmq_auth_backend_oauth2` on RabbitMQ side:
6867

69-
* **Directory (tenant ID)**
70-
* **Application (client) ID**
68+
* Directory (tenant ID)
69+
* Application (client) ID
7170

7271

7372
## Create OAuth 2.0 roles for your app
@@ -146,8 +145,24 @@ Now that some roles have been created for your application, you still need to as
146145

147146
9. Repeat the operations for all the roles you want to assign.
148147

148+
149149
## Create a Scope for Management UI Access
150150

151+
There is one last configuration step required. Without this step, the `access_token` returned
152+
by **Entra ID** is invalid. RabbitMQ cannot validate its signature because the `access_token` is meant for Microsoft resources.
153+
First, you need to create a scope associated to the application you registered for RabbitMQ management UI as follows:
154+
155+
1. Go to **App registrations**.
156+
2. Click on your application.
157+
3. Go to **Manage** option on the left menu and choose the option **Expose an API**.
158+
4. Click on **Add a scope**.
159+
5. Enter a name, eg. `management-ui`. Enter the same name for **Admin consent display name** and a description and save it.
160+
7. The scope is named `api://{Application (client) ID}/{scope_name}`.
161+
162+
Check out the last section to see how this scope is used to configure RabbitMQ.
163+
164+
## Configure Custom Signing Keys
165+
151166
There is one last configuration step required. Without this step, the `access_token` returned
152167
by **Entra ID** won't be useable with RabbitMQ. More specifically, RabbitMQ will not be able to validate its signature because the `access_token` is meant for Microsoft resources
153168

@@ -167,18 +182,20 @@ This scope will be used further below in this guide.
167182
## Configure Custom Signing Keys
168183

169184
Creating a signing key for the application is optional. If a custom key is created, RabbitMQ must be configured accordingly.
170-
In the example below, replace `{Application(client) ID}` with the actual *Application(client) ID*.
185+
In the following example, replace `{Application(client) ID}` with the actual *Application(client) ID*.
171186

172-
Without this bit of configuration, the standard `jwks_uri` endpoint will not include the custom signing key
173-
and therefore RabbitMQ will not find the necessary signing key to validate the token's signature.
187+
```ini
188+
auth_oauth2.discovery_endpoint_params.appid = {Application(client) ID}
189+
```
190+
191+
It is optional to create a signing key for your application. If you create one though, you must add the following RabbitMQ configuration. You need to replace `{Application(client) ID}` with your *Application(client) ID*. Without this configuration, the standard jwks_uri endpoint will not include the custom signing key and RabbitMQ will not find the signing key to validate the token's signature.
174192

175193
```ini
176194
auth_oauth2.discovery_endpoint_params.appid = {Application(client) ID}
177195
```
178196

179197
For more information, check out Microsoft Entra documentation about [configuring custom signing keys](https://learn.microsoft.com/en-us/entra/identity-platform/jwt-claims-customization#validate-token-signing-key).
180198

181-
182199
## Configure RabbitMQ to Use Entra ID as OAuth 2.0 Authentication Backend
183200

184201
The configuration on **Entra ID** side is done. Next, configure RabbitMQ to use these resources.
@@ -193,7 +210,17 @@ Edit the new `rabbitmq.conf` file and proceed as follows:
193210
3. If you decide to configure your application with custom signing(s), you need to uncomment the following configuration line. This is required otherwise the `jwks_uri` endpoint announced by the OpenID Discovery endpoint does not contain applications' custom signing keys.
194211

195212
```ini
196-
#auth_oauth2.discovery_endpoint_params.appid = {Application(client) ID}
213+
#...
214+
215+
management.oauth_enabled = true
216+
management.oauth_client_id = {Application(client) ID}
217+
management.oauth_scopes = openid profile api://{Application(client) ID}/rabbitmq
218+
219+
auth_oauth2.resource_server_id = {Application(client) ID}
220+
auth_oauth2.additional_scopes_key = roles
221+
auth_oauth2.issuer = https://login.microsoftonline.com/{Directory (tenant) ID}/v2.0
222+
223+
#...
197224
```
198225

199226

@@ -207,7 +234,7 @@ make start-rabbitmq
207234
```
208235

209236
This starts a Docker container named `rabbitmq`, with RabbitMQ Management UI/API with HTTPS enabled, and configured to use your Entra ID as OAuth 2.0 authentication backend,
210-
based on the values set in `rabbitmq.conf` in the previous steps of this tutorial.
237+
based on the information you provided in `rabbitmq.conf` in the previous steps of this tutorial.
211238

212239
## Automatic generation of a TLS Certificate and Key Pair
213240

docs/oauth2-examples-okta.md

Lines changed: 21 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -170,35 +170,31 @@ Once you've added the user to the appropriate groups and apps, they should have
170170

171171
This step is necessary otherwise the tokens do not carry any of the scopes granted to the users.
172172

173-
1. [Create an access policy](https://developer.okta.com/docs/guides/customize-authz-server/main/#create-access-policies)
174-
2. [Create a rule](https://developer.okta.com/docs/guides/customize-authz-server/main/#create-rules-for-each-access-policy) for the access policy
173+
1. Create access policy following these [instructions](https://developer.okta.com/docs/guides/customize-authz-server/main/#create-access-policies).
174+
2. Create rule for the access policy following these [instructions](https://developer.okta.com/docs/guides/customize-authz-server/main/#create-rules-for-each-access-policy).
175175

176-
## [Optional] Test the Tokens Issued by Okta
176+
## [Optional] Test the tokens issued by Okta
177177

178-
This step is optional but highly recommended.
178+
This is totally optional but it can save you time.
179179

180-
1. Go to the **default Authorization Server**
181-
2. Click on **Token Preview** tab
182-
3. Fill in all the fields. For **grant type** choose `Authorization Code`
183-
4. Click on **Preview Token** button
184-
5. Check the claim `role` to see if it contains the roles assigned earlier in this guide
180+
1. Go to the **default Authorization Server**.
181+
2. Click on **Token Preview** tab.
182+
3. Fill in all the fields. For **grant type** choose `Authorization Code`.
183+
4. Click on **Preview Token** button.
184+
5. Check the claim `role` to see if it contains the roles you assigned to your user.
185185

186186

187187
## Configure RabbitMQ to use Okta as OAuth 2.0 Authentication Backend
188188

189-
The configuration on the Okta side is done. Next, configure RabbitMQ to use the resources created above.
189+
The configuration on Okta side is done. You now have to configure RabbitMQ to use the resources you just created. You took note of the following values:
190190

191-
For that, you will need the following values from the previous steps:
192-
193-
* **okta_client_app_ID**: the ID of the app registered in Okta to be used with RabbitMQ
194-
* **okta-Issuer**: the **default Authorization server**
195-
* **okta-Metadata-URI**: the **default Authorization server**
196-
197-
Copy [rabbitmq.conf.tmpl](https://github.com/rabbitmq/rabbitmq-oauth2-tutorial/tree/next/conf/okta/rabbitmq.conf.tmpl) from the tutorial repository
198-
to `rabbitmq.conf`. It must be in the same directory as `rabbitmq.conf.tmpl`.
191+
- **okta_client_app_ID** associated to the okta app that you registered in okta for rabbitMQ.
192+
- **okta-Issuer** associated to the **default Authorization server**.
193+
- **okta-Metadata-URI** associated to the **default Authorization server**.
199194

195+
Clone [rabbitmq.conf.tmpl](https://github.com/rabbitmq/rabbitmq-oauth2-tutorial/tree/next/conf/okta/rabbitmq.conf.tmpl) as `rabbitmq.conf` (in the same folder as `rabbitmq.conf.tmpl`).
200196
There is a second configuration file, [advanced.config](https://github.com/rabbitmq/rabbitmq-oauth2-tutorial/tree/next/conf/okta/advanced.config),
201-
that will not need any modifications. This is the RabbitMQ [advanced configuration file](./configure/) where RabbitMQ scopes are mapped to the permissions previously configured in Okta.
197+
that you keep it as it is. This is the RabbitMQ advanced configuration that maps RabbitMQ scopes to the permissions previously configured in Okta.
202198

203199
Edit `rabbitmq.conf` and proceed as follows:
204200

@@ -210,21 +206,14 @@ or `{okta-issuer}/.well-known/openid-configuration`
210206
`auth_oauth2.discovery_endpoint_path` accordingly. For instance, if **okta-Metadata-URI** is `{okta-issuer}/some-other-endpoint`, you update `auth_oauth2.discovery_endpoint_path` with the value `some-other-endpoint`.
211207

212208

213-
### About the OpenId Discovery Endpoint
214-
215-
RabbitMQ uses the standard OpenId discovery endpoint path `.well-known/openid-configuration`. Okta supports this path in addition to `.well-known/oauth-authorization-server`.
216-
The only difference observed between the two endpoints is that the latter returns more values in the `claims_supported` JSON field.
209+
### About OpenId Discovery Endpoint
217210

218-
The RabbitMQ's template configuration provided in the snippet below has this line.
219-
This means that RabbitMQ will use the standard path.
211+
RabbitMQ uses the standard OpenId discovery endpoint path `.well-known/openid-configuration`. Okta supports this path in addition to `.well-known/oauth-authorization-server`. The only difference observed at the time of writing this guide is that the latter returns more values in the json attribute `claims_supported`.
220212

221-
If the default does not work as expected, try uncommenting this line to use
222-
the alternative path.
223-
224-
``` ini
225-
## Uncomment to use '.well-known/oauth-authorization-server' as the discovery
226-
## endpoint path
227-
# auth_oauth2.discovery_endpoint_path = .well-known/oauth-authorization-server
213+
The RabbitMQ's template configuration provided in this example has this line commented out meaning that
214+
RabbitMQ will use the standard path. If you find any problems, try uncommenting this line.
215+
```
216+
#auth_oauth2.discovery_endpoint_path = .well-known/oauth-authorization-server
228217
```
229218

230219
## Start RabbitMQ

docs/oauth2-examples/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ The guide is accompanied by [a public GitHub repository](https://github.com/rabb
4545

4646
### Using [JWT tokens in several protocols](#access-other-protocols) to access RabbitMQ
4747

48-
* [Management HTTP API](#management-http-api)
48+
* [Management REST API](#management-rest-api)
4949
* [AMQP 0-9-1](#amqp-protocol) (and [scopes for topic exchanges](#using-topic-exchanges) in a separate section)
5050
* [AMQP 1.0](#amqp10-protocol)
5151
* [JMS](#jms-clients)
@@ -190,7 +190,7 @@ It is only when the user clicks **Click here to login** , the user is redirected
190190

191191
The following subsections demonstrate how to use access tokens with any messaging protocol and also to access the management HTTP API.
192192

193-
### Management HTTP API {#management-http-api}
193+
### Management REST api {#management-rest-api}
194194

195195
In this scenario a monitoring agent uses RabbitMQ HTTP API to collect monitoring information.
196196
Because it is not an end user, or human, you refer to it as a *service account*.

0 commit comments

Comments
 (0)