Skip to content

Commit 324c139

Browse files
committed
Update the steps for Okta SSO
1 parent b9b6cfb commit 324c139

File tree

1 file changed

+44
-30
lines changed

1 file changed

+44
-30
lines changed

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

Lines changed: 44 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,10 @@ Thus, changing the username claim from `sub` is not recommended.
4848
== Okta
4949

5050
The following examples show how to configure Okta for authentication and authorization using access tokens and ID tokens.
51-
For more information, see the https://developer.okta.com/docs/guides/customize-tokens-groups-claim/main/[Okta official documentation].
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].
5253

53-
=== Access token
54-
55-
This example shows how to configure Okta for authentication and authorization using access tokens.
56-
57-
==== Configure the client
54+
=== Configure the client
5855

5956
. From the right-hand side of the Okta dashboard, navigate to *Applications* and click *Create App Integration*.
6057
. Select *OIDC - OpenID Connect* for Sign-in method and *Single-Page Application* for Application type.
@@ -67,9 +64,9 @@ This URI will accept returned token responses after successful authentication.
6764
. In the *Assignments* section, select *Skip group assignment* for now.
6865
. Click *Save*.
6966
. Take note of the Client ID.
70-
You will need it later when configuring the Okta parameters and the Well-known OpenID Connect endpoint in the _neo4j.conf_ file:
67+
You will need it later when configuring the Okta parameters and the Well-known OpenID Connect endpoint in the _neo4j.conf_ file.
7168

72-
==== Assign Okta groups to the application
69+
=== Assign Okta groups to the application
7370

7471
. From the right-hand side of the Okta dashboard, navigate to *Dashboard -> Directory -> Groups*, and click *Add Group*.
7572
. Add a name for the group, for example, `engineers`, and click *Save*.
@@ -80,12 +77,19 @@ Users can be added to a group either on user creation or by editing the group.
8077
.. Click *Applications* and then *Assign Applications*.
8178
.. Select the application you created earlier and click *Assign*.
8279

83-
==== Configure the default authorization server
80+
=== Configure Neo4j authentication and authorization using Okta access token
81+
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
8485

8586
. From the right-hand side of the Okta dashboard, navigate to *Security -> API*.
8687
. Click the default authorization server (the one that shows `api://default` as audience) to return the `groups` claim in access tokens:
8788
.. On the *Claims* tab, click *Add Claim*.
88-
.. Add a claim with the name `groups` and the value `Groups`, and click *Create*.
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*.
8993

9094
==== Configure Neo4j
9195

@@ -97,11 +101,11 @@ dbms.security.authentication_providers=oidc-okta
97101
dbms.security.authorization_providers=oidc-okta
98102
dbms.security.oidc.okta.display_name=Okta
99103
dbms.security.oidc.okta.auth_flow=pkce
100-
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
101105
dbms.security.oidc.okta.audience=api://default
102106
dbms.security.oidc.okta.claims.username=sub
103107
dbms.security.oidc.okta.claims.groups=groups
104-
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
105109
dbms.security.oidc.okta.authorization.group_to_role_mapping= "engineers" = admin; \
106110
"collaborators" = reader
107111
----
@@ -115,49 +119,59 @@ The `token_type_principal` and the `token_type_authentication` are omitted, mean
115119
+
116120
image::sso-configuration-tutorials/oidc-okta-successful-login.png[title="Okta OIDC successful login"]
117121

118-
=== ID token
122+
=== Configure Neo4j authentication and authorization using Okta ID tokens
119123

120-
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.
121125

122-
. Follow the same steps as for the access token configuration to configure the client and assign Okta groups to the application.
123-
. Configure the default authorization server (the one that shows `api://default` as audience) to return the `groups` claim in ID tokens:
126+
==== Add a groups claim to ID tokens
127+
128+
You can add a groups claim to ID tokens to configure authentication and authorization using ID tokens.
129+
130+
. From the right-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:
124132
.. On the *Claims* tab, click *Add Claim*.
125133
.. Add a claim with the name `groups`.
126134
.. From the *Include in token type* dropdown, select *ID Token*.
127135
.. From the *Value type* dropdown, select *Groups*.
128136
.. From the Filter dropdown, select *Matches regex* and the value `.*`.
129137
.. Click *Create*.
130-
. Create the claims as indicated:
131-
+
132-
image::sso-configuration-tutorials/okta-claims.svg[title="Okta claim creation panel"]
138+
. Add a claim with the name `userid` and the value type `User ID`.
133139
+
134140
[NOTE]
135141
====
136-
In the case of access tokens, a default sub is already provided automatically.
137-
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`.
138144
====
139-
+
140-
. 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:
141155
+
142156
[source, properties]
143157
----
144158
dbms.security.authentication_providers=oidc-okta, native
145159
dbms.security.authorization_providers=oidc-okta
146160
dbms.security.oidc.okta.display_name=Okta
147161
dbms.security.oidc.okta.auth_flow=pkce
148-
dbms.security.oidc.okta.well_known_discovery_uri=https://trial-2696363.okta.com/oauth2/default/.well-known/openid-configuration
149-
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
150164
dbms.security.oidc.okta.claims.username=userid
151165
dbms.security.oidc.okta.claims.groups=groups
152-
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
153167
dbms.security.oidc.okta.authorization.group_to_role_mapping="admin_group" = admin;
154168
dbms.security.oidc.okta.config=token_type_principal=id_token;token_type_authentication=id_token
155169
----
156170
+
157-
. You should now find the audience under Okta's sign-on tab:
158-
+
159-
image::sso-configuration-tutorials/okta-sign-on-tab.svg[title="Okta's sign-on tab"]
160-
+
171+
[TIP]
172+
====
173+
You can find the audience parameter under *OpenID Connect ID Token* of your application on the *Sign On* tab.
174+
====
161175
. (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.
162176
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.
163177
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)