Skip to content

Commit 6062d05

Browse files
Modify Entra example so that it uses v2.0
1 parent d622524 commit 6062d05

File tree

1 file changed

+50
-6
lines changed

1 file changed

+50
-6
lines changed

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

Lines changed: 50 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,26 @@ 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+
<<<<<<< HEAD
2728
* Access the management UI via a browser using v2.0 api version
2829

30+
=======
31+
* Access the management UI via a browser.
32+
>>>>>>> Modify Entra example so that it uses v2.0
2933
3034
## Prerequisites to follow this guide
3135

3236
* Have an account in https://portal.azure.com.
37+
<<<<<<< HEAD
3338
* Docker
3439
* Openssl
3540
* 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
41+
=======
42+
* Docker.
43+
* Openssl.
44+
* `git clone https://github.com/rabbitmq/rabbitmq-oauth2-tutorial`. This github repository
45+
contains all the configuration files and scripts used on this example.
46+
>>>>>>> Modify Entra example so that it uses v2.0
3647
3748
## Register your app
3849

@@ -66,8 +77,13 @@ When using **Entra ID as OAuth 2.0 server**, your client app (in our case Rabbit
6677

6778
Note the following values, as you will need it later to configure the `rabbitmq_auth_backend_oauth2` on RabbitMQ side:
6879

80+
<<<<<<< HEAD
6981
* **Directory (tenant ID)**
7082
* **Application (client) ID**
83+
=======
84+
* Directory (tenant ID)
85+
* Application (client) ID
86+
>>>>>>> Modify Entra example so that it uses v2.0
7187
7288

7389
## Create OAuth 2.0 roles for your app
@@ -146,7 +162,26 @@ Now that some roles have been created for your application, you still need to as
146162

147163
9. Repeat the operations for all the roles you want to assign.
148164

165+
<<<<<<< HEAD
149166
## Create a Scope for Management UI Access
167+
=======
168+
## Create scope required by Management ui during authorization
169+
170+
So far we have created the roles and granted the roles to the user who is going to
171+
access the management UI. When this user logs into RabbitMQ management UI, its token
172+
contains the granted roles.
173+
174+
1. Go to **App registrations**.
175+
2. Click on your application.
176+
3. Go to **Manage** option on the left menu and choose the option **Expose an API**.
177+
4. Click on **Add a scope**.
178+
5. Enter a name, eg. `management-ui`. Enter the same name for **Admin consent display name** and a description and save it.
179+
7. The scope is named `api://{Application (client) ID}/{scope_name}`.
180+
181+
RabbitMQ management ui must provide this scope in `management.oauth_scopes` along with `openid profiles` scopes.
182+
183+
## Configure Custom Signing Keys
184+
>>>>>>> Modify Entra example so that it uses v2.0
150185
151186
There is one last configuration step required. Without this step, the `access_token` returned
152187
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
@@ -167,15 +202,15 @@ This scope will be used further below in this guide.
167202
## Configure Custom Signing Keys
168203

169204
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.
205+
In the following example, replace `{Application(client) ID}` with the actual *Application(client) ID*.
174206

175207
```ini
176208
auth_oauth2.discovery_endpoint_params.appid = {Application(client) ID}
177209
```
178210

211+
Without this bit of configuration, the standard `jwks_uri` endpoint will not include the custom signing key
212+
and therefore RabbitMQ will not find the necessary signing key to validate the token's signature.
213+
179214
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).
180215

181216

@@ -193,9 +228,18 @@ Edit the new `rabbitmq.conf` file and proceed as follows:
193228
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.
194229

195230
```ini
196-
#auth_oauth2.discovery_endpoint_params.appid = {Application(client) ID}
197-
```
231+
#...
198232

233+
management.oauth_enabled = true
234+
management.oauth_client_id = {Application(client) ID}
235+
management.oauth_scopes = openid profile api://{Application(client) ID}/rabbitmq
236+
237+
auth_oauth2.resource_server_id = {Application(client) ID}
238+
auth_oauth2.additional_scopes_key = roles
239+
auth_oauth2.issuer = https://login.microsoftonline.com/{Directory (tenant) ID}/v2.0
240+
241+
#...
242+
```
199243

200244
## Start RabbitMQ
201245

0 commit comments

Comments
 (0)