Skip to content

Commit 717168a

Browse files
MarcialRosalesmichaelklishin
authored andcommitted
Modify Entra example so that it uses v2.0
Conflicts: docs/oauth2-examples-entra-id/index.md
1 parent a2a1467 commit 717168a

File tree

1 file changed

+21
-14
lines changed

1 file changed

+21
-14
lines changed

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

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ 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
27+
* Access the management UI via a browser.
2828

2929
## Prerequisites to follow this guide
3030

@@ -68,14 +68,6 @@ When using **Entra ID as OAuth 2.0 server**, your client app (in our case Rabbit
6868
* Directory (tenant ID)
6969
* Application (client) ID
7070

71-
6. Click on the **Endpoints** tab if it is visible.
72-
7. On the right pane that has just opened, copy the value of **OpenID Connect metadata document** (ex: `https://login.microsoftonline.com/{TENANT_ID}/v2.0/.well-known/openid-configuration`) and open it in your browser.
73-
74-
Note the value of the `jwks_uri` key (ex: `https://login.microsoftonline.com/{TENANT_ID}/discovery/v2.0/keys`), as you will also need it later to configure the `rabbitmq_auth_backend_oauth2` on RabbitMQ side.
75-
76-
![Entra ID JWKS URI](./entra-id-jwks-uri.png)
77-
8. If the **Endpoints** tab is not visible,
78-
7971

8072
## Create OAuth 2.0 roles for your app
8173

@@ -159,6 +151,21 @@ Now that some roles have been created for your application, you still need to as
159151

160152
9. Repeat the operations for all the roles you want to assign.
161153

154+
## Create scope required by Management ui during authorization
155+
156+
So far we have created the roles and granted the roles to the user who is going to
157+
access the management UI. When this user logs into RabbitMQ management UI, its token
158+
contains the granted roles.
159+
160+
1. Go to **App registrations**.
161+
2. Click on your application.
162+
3. Go to **Manage** option on the left menu and choose the option **Expose an API**.
163+
4. Click on **Add a scope**.
164+
5. Enter a name, eg. `management-ui`. Enter the same name for **Admin consent display name** and a description and save it.
165+
7. The scope is named `api://{Application (client) ID}/{scope_name}`.
166+
167+
RabbitMQ management ui must provide this scope in `management.oauth_scopes` along with `openid profiles` scopes.
168+
162169
## Configure Custom Signing Keys
163170

164171
It is optional to create a signing key for your application. If you create one though, you must append an `appid` query parameter containing the *app ID* to the `jwks_uri`. Otherwise, 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.
@@ -180,15 +187,15 @@ Update it with the following values:
180187

181188
```ini
182189
auth_backends.1 = rabbit_auth_backend_oauth2
183-
auth_backends.2 = rabbit_auth_backend_internal
184190

185191
management.oauth_enabled = true
186-
management.oauth_client_id = {PUT YOUR AZURE AD APPLICATION ID}
187-
management.oauth_provider_url = https://login.microsoftonline.com/{YOUR_ENTRA_ID_TENANT_ID}
192+
management.oauth_client_id = {Application(client) ID}
193+
management.oauth_scopes = openid profile api://{Application(client) ID}/rabbitmq
188194

189-
auth_oauth2.resource_server_id = {PUT YOUR AZURE AD APPLICATION ID}
195+
auth_oauth2.resource_server_id = {Application(client) ID}
190196
auth_oauth2.additional_scopes_key = roles
191-
auth_oauth2.jwks_url = {PUT YOUR ENTRA ID JWKS URI VALUE}
197+
auth_oauth2.issuer = https://login.microsoftonline.com/{Directory (tenant) ID}
198+
192199
```
193200

194201
## Start RabbitMQ

0 commit comments

Comments
 (0)