Skip to content

Commit dcf6e50

Browse files
authored
Update Okta examples (#2185)
1 parent 6cd1313 commit dcf6e50

File tree

2 files changed

+75
-40
lines changed

2 files changed

+75
-40
lines changed

modules/ROOT/pages/tutorial/index.adoc

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ The following step-by-step tutorials cover common operational tasks or otherwise
1010
* xref:tutorial/neo4j-admin-import.adoc[Neo4j Admin import] -- This tutorial provides detailed examples to illustrate the capabilities of importing data from CSV files with the command `neo4j-admin database import`.
1111
* xref:tutorial/tutorial-composite-database.adoc[Set up and use a Composite database] -- This tutorial walks through the basics of setting up and using Composite databases.
1212
* xref:tutorial/access-control.adoc[Fine-grained access control] -- This tutorial presents an example that illustrates various aspects of security and fine-grained access control.
13-
* xref:tutorial/tutorial-sso-configuration.adoc[Configuring Neo4j Single Sign-On (SSO)] -- This tutorial presents examples and solutions to common problems when configuring SSO.
13+
* xref:tutorial/tutorial-sso-configuration.adoc[Configuring Neo4j Single Sign-On (SSO)] -- Examples and solutions to common problems when configuring SSO.
1414
* xref:tutorial/tutorial-clustering-docker.adoc[Deploy a Neo4j cluster in a Docker container] -- This tutorial walks through setting up a Neo4j cluster on your local computer for testing purposes.

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

+74-39
Original file line numberDiff line numberDiff line change
@@ -47,32 +47,52 @@ Thus, changing the username claim from `sub` is not recommended.
4747

4848
== Okta
4949

50-
=== Access token
50+
The following examples show how to configure Okta for authentication and authorization using access tokens and ID tokens.
51+
It assumes that you are using Okta Developer Edition Service.
52+
For the complete guide on how to customize tokens returned from Okta with a groups claim, see the https://developer.okta.com/docs/guides/customize-tokens-groups-claim/main/[Okta official documentation].
5153

52-
This example shows how to configure Okta for authentication and authorization using access tokens.
54+
=== Configure the client
5355

56+
. From the left-hand side of the Okta dashboard, navigate to *Applications* and click *Create App Integration*.
57+
. Select *OIDC - OpenID Connect* for Sign-in method and *Single-Page Application* for Application type.
58+
. Click *Next*.
5459
. Configure the client with the appropriate redirect URI.
55-
You can skip the group assignments in this step:
56-
+
57-
image::sso-configuration-tutorials/oidc-okta-client-creation.png[title="Okta OIDC client creation"]
58-
+
59-
image::sso-configuration-tutorials/oidc-okta-client-config-a.png[title="Okta OIDC client configuration"]
60+
.. Add a name for the app integration.
61+
.. Add the *Sign-in redirect URIs*, for example, `http://localhost:7474/browser/?idp_id=okta&auth_flow_step=redirect_uri`.
62+
This URI will accept returned token responses after successful authentication.
63+
. Add the *Sign-out redirect URIs*, for example, `http://localhost:7474/browser/`.
64+
. In the *Assignments* section, select *Skip group assignment* for now.
65+
. Click *Save*.
66+
. Take note of the Client ID.
67+
You will need it later when configuring the Okta parameters and the Well-known OpenID Connect endpoint in the _neo4j.conf_ file.
68+
69+
=== Assign Okta groups to the application
70+
71+
. From the left-hand side of the Okta dashboard, navigate to *Dashboard -> Directory -> Groups*, and click *Add Group*.
72+
. Add a name for the group, for example, `engineers`, and click *Save*.
73+
. Click the group you just created and then click *Assign people*.
74+
. Add users to the group.
75+
Users can be added to a group either on user creation or by editing the group.
76+
. Assign the group to an application.
77+
.. Click *Applications* and then *Assign Applications*.
78+
.. Select the application you created earlier and click *Assign*.
6079

61-
. Take note of the Client ID and the Okta domain.
62-
You will need them later when configuring the Okta parameters and the Well-known OpenID Connect endpoint in the _neo4j.conf_ file:
63-
+
64-
image::sso-configuration-tutorials/oidc-okta-client-config-b.png[title="Okta OIDC client configuration"]
80+
=== Access token
6581

66-
. Create groups in Okta, assign users to them (the user can be added to a group either on user creation or editing the group), and map them in the `neo4j.conf` to native groups:
67-
+
68-
image::sso-configuration-tutorials/oidc-okta-server-groups.png[title="Okta OIDC server groups"]
82+
This example shows how to configure Okta for authentication and authorization using access tokens and how to configure Neo4j to use them.
83+
84+
==== Add a groups claim to access tokens
85+
86+
. From the left-hand side of the Okta dashboard, navigate to *Security -> API*.
87+
. Click the default authorization server (the one that shows `api://default` as audience) to return the `groups` claim in access tokens:
88+
.. On the *Claims* tab, click *Add Claim*.
89+
.. Add a claim with the name `groups`.
90+
.. From the *Value type* dropdown, select *Groups*.
91+
.. From the Filter dropdown, select *Matches regex* and the value `.*`.
92+
.. Click *Create*.
93+
94+
==== Configure Neo4j
6995

70-
. Configure the default authorization server (the one that shows `api://default` as audience) to return the `groups` claim in access tokens:
71-
+
72-
image::sso-configuration-tutorials/oidc-okta-authz-server.png[title="Okta OIDC authorization server"]
73-
+
74-
image::sso-configuration-tutorials/oidc-okta-server-claims.png[title="Okta OIDC server claims"]
75-
+
7696
. Configure Neo4j to use Okta authentication by configuring the following settings in the _neo4j.conf_ file:
7797
+
7898
[source, properties]
@@ -81,11 +101,11 @@ dbms.security.authentication_providers=oidc-okta
81101
dbms.security.authorization_providers=oidc-okta
82102
dbms.security.oidc.okta.display_name=Okta
83103
dbms.security.oidc.okta.auth_flow=pkce
84-
dbms.security.oidc.okta.well_known_discovery_uri=https://dev-21056049.okta.com/oauth2/default/.well-known/openid-configuration
104+
dbms.security.oidc.okta.well_known_discovery_uri=https://dev-54101110.okta.com/oauth2/default/.well-known/oauth-authorization-server
85105
dbms.security.oidc.okta.audience=api://default
86106
dbms.security.oidc.okta.claims.username=sub
87107
dbms.security.oidc.okta.claims.groups=groups
88-
dbms.security.oidc.okta.params=client_id=0oa3oq6uw3uSOBf8y5d7;response_type=code;scope=openid profile email
108+
dbms.security.oidc.okta.params=client_id=0oao2rybx5hIERt5W5d7;response_type=code;scope=openid profile email
89109
dbms.security.oidc.okta.authorization.group_to_role_mapping= "engineers" = admin; \
90110
"collaborators" = reader
91111
----
@@ -101,41 +121,57 @@ image::sso-configuration-tutorials/oidc-okta-successful-login.png[title="Okta OI
101121

102122
=== ID token
103123

104-
This example shows how to configure Okta for authentication and authorization using ID tokens.
124+
This example shows how to configure Okta for authentication and authorization using ID tokens and the how to configure Neo4j to use them.
105125

106-
. Follow the first two steps from the instructions for xref:#_access_token[Access token].
126+
==== Add a groups claim to ID tokens
107127

108-
. Create the claims as indicated:
109-
+
110-
image::sso-configuration-tutorials/okta-claims.svg[title="Okta claim creation panel"]
128+
You can add a groups claim to ID tokens to configure authentication and authorization using ID tokens.
129+
130+
. From the left-hand side of the Okta dashboard, navigate to *Security -> API*.
131+
. Click the default authorization server (the one that shows `api://default` as audience) to return the `groups` claim in access tokens:
132+
.. On the *Claims* tab, click *Add Claim*.
133+
.. Add a claim with the name `groups`.
134+
.. From the *Include in token type* dropdown, select *ID Token*.
135+
.. From the *Value type* dropdown, select *Groups*.
136+
.. From the Filter dropdown, select *Matches regex* and the value `.*`.
137+
.. Click *Create*.
138+
. Add a claim with the name `userid` and the value type `User ID`.
111139
+
112140
[NOTE]
113141
====
114-
In the case of access tokens, a default sub is already provided automatically.
115-
However, for ID tokens, the name you give to your claim needs to be also indicated in the configuration `dbms.security.oidc.okta.claims.username=userid`.
142+
The `userid` claim is not included in the ID token by default like the default `sub` claim for access tokens, thus you need to add it manually.
143+
The name you give to your claim needs to be also indicated in the configuration `dbms.security.oidc.okta.claims.username=userid` in the _neo4j.conf_ file.
116144
====
117-
+
118-
. Configure the default authorization server (the one that shows api://default as audience) as indicated:
145+
.. Click *Add Claim*.
146+
.. Add a claim with the name `userid`.
147+
.. From the *Include in token type* dropdown, select *ID Token*.
148+
.. From the *Value type* dropdown, select *Expression*.
149+
.. In the *Value* field, type `(appuser !=null) ? appuser.userName : app.clientId`.
150+
.. Click *Create*.
151+
152+
==== Configure Neo4j
153+
154+
. Configure Neo4j to use Okta authentication by configuring the following settings in the _neo4j.conf_ file:
119155
+
120156
[source, properties]
121157
----
122158
dbms.security.authentication_providers=oidc-okta, native
123159
dbms.security.authorization_providers=oidc-okta
124160
dbms.security.oidc.okta.display_name=Okta
125161
dbms.security.oidc.okta.auth_flow=pkce
126-
dbms.security.oidc.okta.well_known_discovery_uri=https://trial-2696363.okta.com/oauth2/default/.well-known/openid-configuration
127-
dbms.security.oidc.okta.audience=0oa42hwrygsUCFlLO697
162+
dbms.security.oidc.okta.well_known_discovery_uri=https://dev-54101110.okta.com/oauth2/default/.well-known/oauth-authorization-server
163+
dbms.security.oidc.okta.audience=0oao2rybx5hIERt5W5d7
128164
dbms.security.oidc.okta.claims.username=userid
129165
dbms.security.oidc.okta.claims.groups=groups
130-
dbms.security.oidc.okta.params=client_id=0oa42hwrygsUCFlLO697;response_type=code;scope=openid profile email
166+
dbms.security.oidc.okta.params=client_id=0oao2rybx5hIERt5W5d7;response_type=code;scope=openid profile email
131167
dbms.security.oidc.okta.authorization.group_to_role_mapping="admin_group" = admin;
132168
dbms.security.oidc.okta.config=token_type_principal=id_token;token_type_authentication=id_token
133169
----
134170
+
135-
. You should now find the audience under Okta's sign-on tab:
136-
+
137-
image::sso-configuration-tutorials/okta-sign-on-tab.svg[title="Okta's sign-on tab"]
138-
+
171+
[TIP]
172+
====
173+
You can find the audience parameter under *OpenID Connect ID Token* of your application on the *Sign On* tab.
174+
====
139175
. (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.
140176
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.
141177
For information on how to create users in this mode, see xref:authentication-authorization/manage-users.adoc#access-control-create-users[Creating users].
@@ -221,7 +257,6 @@ image::sso-configuration-tutorials/oidc-azure-client-creation.png[title="Entra O
221257
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.
222258
. Click *Register*.
223259

224-
225260
==== Configure Neo4j
226261
. 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.
227262
+

0 commit comments

Comments
 (0)