You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/management/index.md
+27-15Lines changed: 27 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -404,10 +404,10 @@ management.oauth_scopes = <SPACE-SEPARATED LIST OF SCOPES. See below>
404
404
-`oauth_scopes` is a mandatory field which must be set at all times except in the case when OAuth providers automatically grant scopes associated to the `oauth_client_id`. `oauth_scopes` is a list of space-separated strings that indicate which permissions the application is requesting. Most OAuth providers only issue tokens with the scopes requested during the user authentication. RabbitMQ sends this field along with its `oauth_client_id` during the user authentication. If this field is not set, RabbitMQ defaults to `openid profile`.
405
405
406
406
Given above configuration, when a user visits the management UI, the following two events take place:
407
-
1. RabbitMQ uses the URL found in `auth_oauth2.issuer` to download the OpenID Provider configuration. Check out the [OAuth 2.0](./oauth2#discovery-endpoint-params) documentation about OpenId discovery endpoint to learn more about it.
407
+
1. RabbitMQ uses the URL found in `auth_oauth2.issuer` to download the OpenID Provider configuration. Learn more in the [OAuth 2.0 guide](./oauth2#discovery-endpoint-params)
408
408
409
409
:::warning
410
-
If RabbitMQ cannot download the OpenID provider configuration, it shows an error message and OAuth 2.0 authentication is disabled in the management UI.
410
+
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
411
411
:::
412
412
413
413
:::tip
@@ -510,18 +510,29 @@ RabbitMQ 3.13.1 and earlier versions require the [OpenId Connect Discovery endpo
510
510
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.
511
511
The second scenario is when the management UI session exceeds the maximum allowed time configured on the [Login Session Timeout](#login-session-timeout).
512
512
513
-
### Configure extra parameters for authorization and token endpoints {#extra-endpoint-params}
513
+
### Configure Extra URI Parameters for Authorization and Token Endpoints {#extra-endpoint-params}
514
514
515
-
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.
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.
516
517
517
-
Here is an example of setting an extra parameter called `audience` for both endpoints, the **authorization** and **token**endpoint:
518
+
In the followingexample an extra URI parameter called `audience`is added for both the **authorization** and **token**endpoints:
####Configure extra parameters for authorization and token endpoints
632
+
### Configure Extra URI Parameters for Authorization and Token Endpoints {#extra-endpoint-params}
622
633
623
-
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.
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.
624
636
625
-
Here is an example of setting an extra parameter called `audience` for both endpoints for the resource `some-resource-id`:
637
+
The following example sets an extra URI parameter called `audience` for both endpoints for the resource `some-resource-id`:
Copy file name to clipboardExpand all lines: docs/oauth2-examples-auth0.md
+14-11Lines changed: 14 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
---
2
-
title: Use https://auth0.com/ as Auth 2.0 server
2
+
title: Use auth0.com as OAuth 2.0 Server
3
3
displayed_sidebar: docsSidebar
4
4
---
5
5
<!--
@@ -19,26 +19,26 @@ See the License for the specific language governing permissions and
19
19
limitations under the License.
20
20
-->
21
21
22
-
# Use https://auth0.com/ as OAuth 2.0 server
22
+
# Use [auth0.com](https://auth0.com) as OAuth 2.0 server
23
23
24
24
This guide explains how to set up OAuth 2.0 for RabbitMQ
25
25
and Auth0 as Authorization Server using the following flows:
26
26
27
27
* Access [management UI](./management/) via a browser
28
-
* Access management rest api
28
+
* Access management HTTP API
29
29
* Application authentication and authorization
30
30
31
31
## Prerequisites to follow this guide
32
32
33
-
* Have an account in https://auth0.com/.
33
+
* Have an [Auth0](https://auth0.com/) account
34
34
* Docker
35
35
* A local clone of a [GitHub repository](https://github.com/rabbitmq/rabbitmq-oauth2-tutorial) that contains all the configuration files and scripts used on this example
36
36
37
37
## Create RabbitMQ API
38
38
39
39
In Auth0, resources are mapped to Application APIs.
40
40
41
-
1.Once you have logged onto your account in https://auth0.com/, go to **dashboard > Applications > APIs > Create an API**.
41
+
1.After logging into the Auth0 account, go to **dashboard > Applications > APIs > Create an API**.
42
42
2. Give it the name `rabbitmq`. The important thing here is the `identifier` which must have the name of the *resource_server_id* we configured in RabbitMQ. This `identifier` goes into the `audience` JWT field. In our case, it is called `rabbitmq`.
43
43
3. Choose `RS256` as the signing algorithm.
44
44
4. Enable **RBAC**.
@@ -99,7 +99,8 @@ To configure RabbitMQ you need to gather the following information from Auth0:
99
99
4. And take note of the *Domain* value
100
100
5. Use the last values in *Client ID* and *Domain* fields in the RabbitMQ configuration file
101
101
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`).
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`.
103
104
104
105
Edit `rabbitmq.conf` and proceed as follows:
105
106
@@ -108,12 +109,14 @@ Edit `rabbitmq.conf` and proceed as follows:
108
109
109
110
:::important
110
111
111
-
Since RabbitMQ 4.1.x, you must configure RabbitMQ to include a request parameter
112
-
called `audience` whose value matches the value you set in `auth_oauth2.resource_server_id`.
113
-
Earlier RabbitMQ versions always sent this parameter. If you do not configure it,
114
-
Auth0 sends an invalid token and RabbitMQ shows the error message `No authorized`.
112
+
Starting with RabbitMQ 4.1.x, you must configure RabbitMQ to include a URI parameter
113
+
called `audience` whose value matches the value of `auth_oauth2.resource_server_id`.
115
114
116
-
These [two configuration lines](https://github.com/rabbitmq/rabbitmq-oauth2-tutorial/blob/main/conf/auth0/rabbitmq.conf.tmpl#L8-L9) configure the `audience` parameter with the value `rabbitmq`.
115
+
Earlier RabbitMQ versions always sent this URI parameter. If this additional URI parameter is not configured,
116
+
Auth0 will consider the token invalid and RabbitMQ will display "No authorized" for error.
117
+
118
+
These [two configuration lines](https://github.com/rabbitmq/rabbitmq-oauth2-tutorial/blob/main/conf/auth0/rabbitmq.conf.tmpl#L8-L9)
119
+
configure the `audience` parameter with the value `rabbitmq`.
Copy file name to clipboardExpand all lines: docs/oauth2-examples-entra-id/index.md
+25-16Lines changed: 25 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -49,7 +49,7 @@ When using **Entra ID as OAuth 2.0 server**, your client app (in our case Rabbit
49
49
4. In the **Register an application** pane, provide the following information:
50
50
51
51
***Name**: the name you would like to give to your application (ex: *rabbitmq-oauth2*)
52
-
***Supported Account Types**: select **Accounts in this organizational directory only (Default Directory only - Single tenant)** (you can choose other options if you want to enlarge the audience of your app)
52
+
***Supported Account Types**: select **Accounts in this organizational directory only (Default Directory only - Single tenant)** (this guide will focus on this option for simplicity)
53
53
* On the **Select a platform** drop-down list, select **Single-page application (SPA)**
54
54
* Configure the **Redirect URI** to: `https://localhost:15671/js/oidc-oauth/login-callback.html`
55
55
@@ -66,8 +66,8 @@ When using **Entra ID as OAuth 2.0 server**, your client app (in our case Rabbit
66
66
67
67
Note the following values, as you will need it later to configure the `rabbitmq_auth_backend_oauth2` on RabbitMQ side:
68
68
69
-
***Directory (tenant ID)**.
70
-
***Application (client) ID**.
69
+
***Directory (tenant ID)**
70
+
***Application (client) ID**
71
71
72
72
73
73
## Create OAuth 2.0 roles for your app
@@ -146,36 +146,45 @@ Now that some roles have been created for your application, you still need to as
146
146
147
147
9. Repeat the operations for all the roles you want to assign.
148
148
149
-
## Create scope for management UI
149
+
## Create a Scope for Management UI Access
150
150
151
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:
152
+
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
154
153
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}`.
154
+
Therefore, create a new scope associated with the application registered above to be used for RabbitMQ management UI.
155
+
To do so:
156
+
157
+
1. Go to **App registrations**
158
+
2. Click on your application
159
+
3. Go to **Manage** option on the left menu and choose the option **Expose an API**
160
+
4. Click on **Add a scope**
161
+
5. Enter a name, eg. `management-ui`. Enter the same name for **Admin consent display name** and a description and save it
162
+
7. The scope is named `api://{Application (client) ID}/{scope_name}`
163
+
164
+
This scope will be used further below in this guide.
161
165
162
-
Check out the last section to see how this scope is used to configure RabbitMQ.
163
166
164
167
## Configure Custom Signing Keys
165
168
166
-
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.
169
+
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*.
171
+
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.
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).
173
180
181
+
174
182
## Configure RabbitMQ to Use Entra ID as OAuth 2.0 Authentication Backend
175
183
176
184
The configuration on **Entra ID** side is done. Next, configure RabbitMQ to use these resources.
177
185
178
-
Clone the file called [rabbitmq.conf.tmpl](https://github.com/rabbitmq/rabbitmq-oauth2-tutorial/tree/main/conf/entra/rabbitmq.conf.tmpl) as `rabbitmq.conf` (in the same folder as `rabbitmq.conf.tmpl`).
186
+
Clone [rabbitmq.conf.tmpl](https://github.com/rabbitmq/rabbitmq-oauth2-tutorial/tree/main/conf/entra/rabbitmq.conf.tmpl) from the tutorial repository
187
+
to `rabbitmq.conf`. It must be in the same directory as `rabbitmq.conf.tmpl`.
179
188
180
189
Edit the new `rabbitmq.conf` file and proceed as follows:
181
190
@@ -198,7 +207,7 @@ make start-rabbitmq
198
207
```
199
208
200
209
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,
201
-
based on the information you provided in `rabbitmq.conf` in the previous steps of this tutorial.
210
+
based on the values set in `rabbitmq.conf` in the previous steps of this tutorial.
202
211
203
212
## Automatic generation of a TLS Certificate and Key Pair
0 commit comments