Skip to content

Commit c71914f

Browse files
authored
Update Azure SSO tutorial (#2208)
1 parent 6576def commit c71914f

File tree

1 file changed

+67
-66
lines changed

1 file changed

+67
-66
lines changed

modules/ROOT/pages/tutorial/tutorial-sso-configuration.adoc

Lines changed: 67 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -192,90 +192,90 @@ See xref:authentication-authorization/sso-integration.adoc#auth-sso-auth-provide
192192

193193
== Microsoft Entra ID (formerly Azure Active Directory)
194194

195+
The following examples show how to configure Microsoft Entra ID for authentication and authorization using access tokens and ID tokens.
196+
197+
=== Register the application
198+
199+
. Log in to the https://portal.azure.com/#home[Azure portal].
200+
. Click *Microsoft Entra ID* and navigate to *Manage -> App registrations*.
201+
. Click *New registration*.
202+
. Type a name for your application, for example, `Neo4j SSO`.
203+
. Under *Select the supported account types*, select `Accounts in this organizational directory only (Default Directory only - Single tenant)`.
204+
. Under *Redirect URI*, select `Single-page application (SPA)` and enter the redirect URI: `http://localhost:7474/browser/?idp_id=azure&auth_flow_step=redirect_uri`
205+
The redirect URI will accept the returned token responses after successful authentication.
206+
. Click *Register*.
207+
195208
=== Access token
196209

197-
This example shows how to configure Entra ID for authentication and authorization using an access token.
210+
This example shows how to configure Neo4j to use an Entra ID access token for authentication and authorization.
211+
212+
==== Configure Entra ID
198213

199-
. After the successful creation of your SSO application in Azure, open the *Token configuration* tab to configure a token.
214+
. From the *App registrations* page, select the app you just created.
215+
. From the left-hand side menu, navigate to *Manage -> Token configuration*.
200216
.. Click *Add groups claim*.
201-
.. Select *Security groups* to include in your access token.
217+
.. Select *Groups assigned to the application (recommended for large enterprise companies to avoid exceeding the limit on the number of groups a token can emit)* to include in your access token.
202218
.. Save your changes.
203219

204-
. Open the **Expose an API** tab and select **Add a Scope**.
205-
.. If you click the **Add a Scope** button for the first time, you see a new pane stating that you need to add an _Application ID URI_ before proceeding.
220+
. Navigate to *Expose an API* and click **Add a Scope**.
206221
+
222+
[NOTE]
223+
====
224+
The first time you click the *Add a Scope* button, you see a new pane stating that you need to add an _Application ID URI_ before proceeding.
207225
You can find it on your app *Overview* page.
208-
+
209-
.The GUID is used to identify specific resources or instances within Azure. You can find it on the app registration page.
210-
image::sso-configuration-tutorials/azure-id.svg[]
211-
+
212-
.. Click *Save and continue* after setting the _Application ID URI_.
226+
It is a GUID that looks like this: `api://<GUID>`.
227+
The GUID is a unique identifier for your application.
228+
====
213229

230+
. Click *Save and continue* after setting the _Application ID URI_.
214231
. Fill in all mandatory fields in the pane **Add a scope**.
215-
.. Enter a new *Scope name*, *Admin consent display name*, and *Admin consent description*.
232+
.. Enter a new *Scope name* (e.g., `access-token`), *Admin consent display name*, and *Admin consent description*.
216233
.. Make sure the *Enabled* scope state is selected.
217234
.. Select the *Add scope* button again to create a new scope.
218235
You can add all scopes supported by your API.
219-
+
220-
Once the scopes are created, make a note of them for use later.
236+
Make a note of them for later.
237+
238+
==== Configure Neo4j
239+
240+
You can configure Neo4j to use Entra ID for authentication by configuring the following settings in the _neo4j.conf_ file:
221241

222-
. Configure Neo4j to use Entra ID for authentication by configuring the following settings in the _neo4j.conf_ file:
223-
+
224242
[source, properties]
225243
----
226244
# Configure the access_token
227245
dbms.security.oidc.azure.config=principal=unique_name;code_challenge_method=S256;token_type_principal=access_token;token_type_authentication=access_token
228246
# Configure the OIDC token endpoint with the Directory (tenant) ID
229247
dbms.security.oidc.azure.token_endpoint=https://login.microsoftonline.com/54e85725-ed2a-49a4-a19e-11c8d29f9a0f/oauth2/v2.0/token
230248
# Configure the iss claim in the id token with the Directory (tenant) ID
231-
# Make sure you add the trailing slash (`/`) at the end of the URL, or this operation might fail.
249+
# Make sure you add the trailing slash (`/`) at the end of the URL or this operation might fail.
232250
dbms.security.oidc.azure.issuer=https://sts.windows.net/54e85725-ed2a-49a4-a19e-11c8d29f9a0f/
233251
# Provide the Entra ID parameters, such as client_id, response_type, scope, etc.
234252
dbms.security.oidc.azure.params=client_id=4376dc8b-b5af-424f-9ada-c1c1b2d416b9;response_type=code;scope=openid profile email api://4376dc8b-b5af-424f-9ada-c1c1b2d416b9/access-token
235253
----
236-
+
237-
[NOTE]
238-
====
239-
As previously mentioned, the GUID here is also the Directory (tenant) ID.
240-
Make sure you add the trailing slash (`/`) at the end or this operation might fail.
241-
242-
The audience parameter for access tokens is typically set with `api://` at the front.
243-
====
244-
245254

246255
=== ID token
247256

248-
This example shows how to configure Entra ID for authentication and authorization using ID tokens.
249-
250-
==== Register the application
251-
252-
. Log in to the https://portal.azure.com/#home[Azure portal].
253-
. Navigate to *Microsoft Entra ID > Overview*.
254-
. From the *Add* dropdown menu, select *App registration* and fill in the following information to create your SSO application:
255-
+
256-
image::sso-configuration-tutorials/oidc-azure-client-creation.png[title="Entra OIDC client creation"]
257-
The redirect URI `http://localhost:7474/browser/?idp_id=azure&auth_flow_step=redirect_uri` is the URI that will accept returned token responses after successful authentication.
258-
. Click *Register*.
257+
This example shows how to configure Neo4j to use an Entra ID ID token for authentication and authorization.
259258

260259
==== Configure Neo4j
261-
. After the successful app creation, on the app's *Overview* page, find the Application (client) ID value. Use it to configure the following properties in the _neo4j.conf_ file.
260+
261+
. From the *App registrations* page, select the app you created in <<#_register_the_application,Register the application>>.
262+
. On the application *Overview* page, copy the Application (client) ID value and use it to configure the following properties in the _neo4j.conf_ file:
262263
+
263264
[source, properties]
264265
----
265-
dbms.security.oidc.azure.audience=c2830ff5-86d9-4e38-8a2b-9efad6f3d06d
266-
dbms.security.oidc.azure.params=client_id=c2830ff5-86d9-4e38-8a2b-9efad6f3d06d;response_type=code;scope=openid profile email
266+
dbms.security.oidc.azure.audience=4376dc8b-b5af-424f-9ada-c1c1b2d416b9
267+
dbms.security.oidc.azure.params=client_id=4376dc8b-b5af-424f-9ada-c1c1b2d416b9;response_type=code;scope=openid profile email
267268
----
268269

269-
. Navigate to *Endpoints*, to find the OpenID Connect metadata document. Use it to configure the `well_known_discovery_uri` in the _neo4j.conf_ file.
270-
+
271-
image::sso-configuration-tutorials/oidc-azure-client-config.png[title="Entra OIDC client config"]
270+
. On the app's *Overview* page, click the *Endpoints* tab, and copy the *OpenID Connect metadata document* URI:
271+
Use it to configure the `well_known_discovery_uri` in the _neo4j.conf_ file.
272272
+
273273
[source, properties]
274274
----
275-
dbms.security.oidc.azure.well_known_discovery_uri=https://login.microsoftonline.com/ce976899-299d-4a01-91e5-a5fee8f98626/v2.0/.well-known/openid-configuration
275+
dbms.security.oidc.azure.well_known_discovery_uri=https://login.microsoftonline.com/54e85725-ed2a-49a4-a19e-11c8d29f9a0f/v2.0/.well-known/openid-configuration
276276
----
277277

278-
. Configure Neo4j to use Entra ID authentication by configuring the following settings in the _neo4j.conf_ file:
278+
. Configure Neo4j to use Entra ID authentication in the _neo4j.conf_ file:
279279
+
280280
[source, properties]
281281
----
@@ -303,7 +303,7 @@ dbms.security.oidc.azure.claims.username=sub
303303

304304
Decide whether you want to use Entra groups directly or Entra App Roles.
305305

306-
Using Entra groups directly might be convenient if you already have users assigned to those groups and want to perform Group-to-Role mapping in Neo4j settings.
306+
Using Entra groups directly might be convenient if you already have users assigned to those groups and want to perform Group-to-Role mapping in the _neo4j.conf_ file.
307307

308308
Entra App Roles allow a layer of separation between Neo4j roles and groups.
309309
When App Roles are used, only the roles relevant to Neo4j are sent in the JWT token.
@@ -314,27 +314,25 @@ Details about Entra ID App Roles can be found in the https://learn.microsoft.com
314314

315315
==== Using Entra groups directly
316316

317-
. Configure the server to return the Group Object IDs in the JWT identity tokens.
318-
To do this, set `groupMembershipClaims` to `SecurityGroup` in the Manifest of the registered application:
319-
+
320-
image::sso-configuration-tutorials/oidc-azure-server-claims.png[title="Entra OIDC server claims"]
321-
322-
. Create groups in the Entra AD console and assign users to them.
323-
Take note of the Object Id column.
324-
In the next step, you must map these to user roles in the Neo4j settings.
317+
. From the *App registrations* page, select your application.
318+
. From the left-hand side menu, navigate to *Manage -> Manifest*.
319+
. Verify that the server is configured to return the Group Object IDs in the JWT identity tokens:
325320
+
326-
image::sso-configuration-tutorials/oidc-azure-server-groups.png[title="Entra OIDC server groups"]
327-
328-
. Configure a mapping from Entra Group Object IDs to Neo4j roles.
321+
[source, json]
322+
----
323+
"groupMembershipClaims": "SecurityGroup, ApplicationGroup",
324+
----
325+
. From the left-hand side menu, navigate to *Manage -> Groups*.
326+
. Create groups and assign users to them.
327+
Take note of the *Object Id* column.
328+
. Configure a mapping from Entra Group Object Ids to Neo4j roles.
329329
For details, see xref:authentication-authorization/sso-integration.adoc#auth-sso-map-idp-roles[Map the identity provider groups to the Neo4j roles].
330330
+
331331
[source, properties]
332332
----
333333
dbms.security.oidc.azure.authorization.group_to_role_mapping= "e8b6ddfa-688d-4ace-987d-6cc5516af188" = admin; \
334334
"9e2a31e1-bdd1-47fe-844d-767502bd138d" = reader
335335
----
336-
+
337-
338336
. Configure Neo4j to use the `groups` field from the JWT token.
339337
+
340338
[source, properties]
@@ -344,27 +342,30 @@ dbms.security.oidc.azure.claims.groups=groups
344342

345343
==== Using Entra ID App roles
346344

347-
. On the app's home page, navigate to *App roles* and add the Neo4j roles to the Microsoft Entra ID.
348-
+
349-
image::sso-configuration-tutorials/oidc-azure-app-roles.png[title="Entra OIDC app roles config"]
350-
351-
. The *Value* column in the App roles config must either correspond to Neo4j roles or be mapped in the _neo4j.conf_ file.
345+
. From the left-hand side menu, navigate to *App roles* and add the Neo4j roles to the Microsoft Entra ID.
346+
.. Click *Create app role*.
347+
.. Fill in the fields:
348+
... *Display name*: `admin`
349+
... *Allowed member types*: `Users/Groups`
350+
... *Value*: `admin`. +
351+
The *Value* column must either correspond to the Neo4j roles or be mapped in the _neo4j.conf_ file.
352+
... *Description*: `Neo4j admin role`
353+
.. Click *Apply*.
354+
. Repeat the previous step for the other roles you want to add.
355+
. Configure a mapping from Entra App Roles to Neo4j roles in the _neo4j.conf_ file.
352356
For details, see xref:authentication-authorization/sso-integration.adoc#auth-sso-map-idp-roles[Map the identity provider groups to the Neo4j roles].
353357
+
354358
[source, properties]
355359
----
356360
dbms.security.oidc.azure.authorization.group_to_role_mapping= "managers" = admin; \
357361
"engineers" = reader
358362
----
359-
360363
. Configure Neo4j to use the `roles` field from the JWT token.
361364
+
362365
[source, properties]
363-
364366
----
365367
dbms.security.oidc.azure.claims.groups=roles
366368
----
367-
368369
. (Optional) If you want control the authentication and authorization on a user level, configure xref:configuration/configuration-settings.adoc#config_dbms.security.require_local_user[`dbms.security.require_local_user`] to `true` in the _neo4j.conf_ file.
369370
This setting mandates that users with the relevant auth provider attached to them must exist in the database before they can authenticate and authorize with that auth provider.
370371
For information on how to create users in this mode, see xref:authentication-authorization/manage-users.adoc#access-control-create-users[Creating users].

0 commit comments

Comments
 (0)