Skip to content

Commit d0dafa6

Browse files
updated documentation
1 parent 3e50c0f commit d0dafa6

File tree

2 files changed

+92
-17
lines changed

2 files changed

+92
-17
lines changed

modules/ROOT/pages/database-administration/aliases/manage-aliases-standard-databases.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,7 @@ FOR DATABASE
421421
----
422422

423423
The `OIDC CREDENTIAL FORWARDING` clause is used to configure a remote database alias to use the logged-in user's OIDC credentials to authenticate to the remote DBMS.
424+
In order to use this method to authenticate, the local DBMS and remote DBMS needs to have SSO authentication and authorization through identity providers implementing the OIDC standard configured, see the xref:authentication-authorization/sso-integration.adoc[SSO integration] on how to configure OIDC identity providers.
424425

425426
.Query
426427
[source, cypher]

modules/ROOT/pages/database-administration/aliases/remote-database-alias-configuration.adoc

Lines changed: 91 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,13 @@ A remote alias defines:
2020
* Where the remote database is located.
2121
* How to connect to the remote database using driver settings.
2222
23-
When creating the remote database alias, it can either be configured to store the credentials of a single user on the remote **DBMS B**, or to pass on the bearer authentication token from the user who issues the query.
23+
When creating the remote database alias, it can be configured to authenticate with either:
2424

25+
* `STORED NATIVE CREDENTIALS`, i.e. the credentials of a single user on the remote **DBMS B**.
26+
* `OIDC CREDENTIAL FORWARDING`, i.e. passing the bearer authentication token from the user who issues the query. In order to use this method to authenticate, the local *DBMS A* and remote *DBMS B* needs to have SSO authentication and authorization through identity providers implementing the OIDC standard configured, see the xref:authentication-authorization/sso-integration.adoc[SSO integration] on how to configure OIDC identity providers.
27+
28+
29+
[[setup-example-stored-native-credentials]]
2530
== Setup example with stored native credentials
2631

2732
In this example, _Alice_ is an administrator and _Carol_ is a user who needs access to a database managed by _Bob_:
@@ -147,6 +152,55 @@ chmod 640 conf/neo4j.conf
147152
bin/neo4j start --expand-commands
148153
----
149154

155+
=== Manage remote database aliases
156+
157+
You can use the xref:database-administration/aliases/manage-aliases-standard-databases.adoc[alias commands] to manage remote database aliases.
158+
In this case, it is strongly recommended to connect to a remote database alias with a secured connection.
159+
160+
Please note that only client-side SSL is supported.
161+
By default, remote aliases require a secured URI scheme such as `neo4j+s`.
162+
This can be disabled by setting the driver setting `ssl_enforced` to `false`.
163+
164+
For example, the following command can be used to create a remote database alias with stored native credentials:
165+
166+
[source, Cypher]
167+
----
168+
CREATE ALIAS `remote-neo4j` FOR DATABASE `neo4j` AT "neo4j+s://location:7687" USER alice PASSWORD 'secretpassword'
169+
----
170+
171+
In order to do so, either xref:authentication-authorization/dbms-administration.adoc#access-control-dbms-administration-database-management[database management]
172+
or xref:authentication-authorization/dbms-administration.adoc#access-control-dbms-administration-alias-management[alias management] privileges are required.
173+
The permission to create an alias can be granted like this:
174+
175+
[source, Cypher]
176+
----
177+
GRANT CREATE ALIAS ON DBMS TO administrator
178+
----
179+
180+
Here is how to grant the xref:authentication-authorization/database-administration.adoc#access-control-database-administration-access[`ACCESS` privileges] to use the remote database alias:
181+
182+
[source, Cypher]
183+
----
184+
GRANT ACCESS ON DATABASE `remote-neo4j` TO role
185+
----
186+
187+
[NOTE]
188+
====
189+
If a transaction modifies an alias (e.g. changing the database targeted on **DBMS B**), other transactions concurrently executing against that alias may be aborted and rolled back for safety.
190+
This prevents issues such as a transaction executing against multiple target databases for the same alias.
191+
====
192+
193+
=== Change the encryption key
194+
195+
If the encryption key in the keystore is changed, the encrypted credentials for existing remote database aliases will need to be updated as they will no longer be readable.
196+
197+
[NOTE]
198+
====
199+
If there is a failure when reading the keystore file, investigate the `debug.log` to find out which parameter is the source of the problem.
200+
In case it is not possible to connect to the remote alias after its creation, verify its settings by connecting to the remote database at https://browser.neo4j.io/ or at your local browser.
201+
====
202+
203+
[[setup-example-credential-forwarding]]
150204
== Setup example with OIDC credential forwarding
151205

152206
In order to use OIDC credential forwarding, both *DBMS A* and *DBMS B* need to support the same OIDC identity provider, see the xref:authentication-authorization/sso-integration.adoc[SSO integration] on how to enable OIDC.
@@ -192,6 +246,13 @@ dbms.ssl.policy.bolt.client_auth=NONE
192246
193247
# enforcing ssl connection
194248
server.bolt.tls_level=REQUIRED
249+
250+
# OIDC settings - these should be the same on both DBMSs
251+
dbms.security.oidc.<provider>.well_known_discovery_uri=http://example.com/.well-known/discovery
252+
<...>
253+
dbms.security.oidc.<provider>.claims.groups=groups
254+
dbms.security.oidc.<provider>.authorization.group_to_role_mapping= "engineers" = admin; \
255+
"collaborators" = reader
195256
----
196257

197258
=== Configure a DBMS with a remote database alias (_Alice_)
@@ -201,8 +262,16 @@ The steps _Alice_, need to take are:
201262
. Set up SSO and support for the identity provider.
202263
. Map the identity provider groups to the Neo4j roles. This is where the permission to use the remote database alias is set.
203264

204-
205-
== Manage remote database aliases
265+
[source, Example of additional configuration]
266+
----
267+
# OIDC settings - these should be the same on both DBMSs
268+
dbms.security.oidc.<provider>.well_known_discovery_uri=http://example.com/.well-known/discovery
269+
<...>
270+
dbms.security.oidc.<provider>.claims.groups=groups
271+
dbms.security.oidc.<provider>.authorization.group_to_role_mapping= "engineers" = admin; \
272+
"collaborators" = reader
273+
----
274+
=== Manage remote database aliases
206275

207276
You can use the xref:database-administration/aliases/manage-aliases-standard-databases.adoc[alias commands] to manage remote database aliases.
208277
In this case, it is strongly recommended to connect to a remote database alias with a secured connection.
@@ -211,15 +280,15 @@ Please note that only client-side SSL is supported.
211280
By default, remote aliases require a secured URI scheme such as `neo4j+s`.
212281
This can be disabled by setting the driver setting `ssl_enforced` to `false`.
213282

214-
For example, the following command can be used to create a remote database alias:
283+
For example, the following command can be used to create a remote database alias with OIDC credential forwarding:
215284

216285
[source, Cypher]
217286
----
218-
CREATE ALIAS `remote-neo4j` FOR DATABASE `neo4j` AT "neo4j+s://location:7687" USER alice PASSWORD 'secretpassword'
287+
CREATE ALIAS `remote-neo4j` FOR DATABASE `neo4j` AT "neo4j+s://location:7687" OIDC CREDENTIAL FORWARDING
219288
----
220289

221-
In order to do so, either lxref:authentication-authorization/dbms-administration.adoc#access-control-dbms-administration-database-management[database management]
222-
or lxref:authentication-authorization/dbms-administration.adoc#access-control-dbms-administration-alias-management[alias management] privileges are required.
290+
In order to do so, either xref:authentication-authorization/dbms-administration.adoc#access-control-dbms-administration-database-management[database management]
291+
or xref:authentication-authorization/dbms-administration.adoc#access-control-dbms-administration-alias-management[alias management] privileges are required.
223292
The permission to create an alias can be granted like this:
224293

225294
[source, Cypher]
@@ -231,25 +300,22 @@ Here is how to grant the xref:authentication-authorization/database-administrati
231300

232301
[source, Cypher]
233302
----
234-
GRANT ACCESS ON DATABASE `remote-neo4j` TO role
303+
GRANT ACCESS ON DATABASE `remote-neo4j` TO admin
235304
----
236305

237306
[NOTE]
238307
====
239-
If a transaction modifies an alias (e.g. changing the database targeted on **DBMS B**), other transactions concurrently executing against that alias may be aborted and rolled back for safety.
240-
This prevents issues such as a transaction executing against multiple target databases for the same alias.
308+
In order for _Carol_ to get access to the remote database alias, she needs to be in an identity provider group that is mapped to a Neo4j role that is granted access to alias. In this example, if _Carol_ is in the identity provider group `engineers` which is mapped to the admin role, she will get the privileges of an admin and access to `remote-neo4j`.
309+
For details on how to map identity provider groups to Neo4j roles, see xref:authentication-authorization/sso-integration.adoc#auth-sso-map-idp-roles[Map the identity provider groups to the Neo4j roles].
241310
====
242311

243-
== Change the encryption key
244-
245-
If the encryption key in the keystore is changed, the encrypted credentials for existing remote database aliases will need to be updated as they will no longer be readable.
246-
247312
[NOTE]
248313
====
249-
If there is a failure when reading the keystore file, investigate the `debug.log` to find out which parameter is the source of the problem.
250-
In case it is not possible to connect to the remote alias after its creation, verify its settings by connecting to the remote database at https://browser.neo4j.io/ or at your local browser.
314+
If a transaction modifies an alias (e.g. changing the database targeted on **DBMS B**), other transactions concurrently executing against that alias may be aborted and rolled back for safety.
315+
This prevents issues such as a transaction executing against multiple target databases for the same alias.
251316
====
252317

318+
253319
== Connect to remote database aliases
254320

255321
A user can connect to a remote database alias the same way they would do to a database.
@@ -265,7 +331,7 @@ USE `remote-neo4j` MATCH (n) RETURN *
265331

266332
* Connecting to a remote database alias as a home database.
267333
This needs to be set by Administrator A.
268-
See more about lxref:authentication-authorization/dbms-administration.adoc#access-control-dbms-administration-user-management[User Management].
334+
See more about xref:authentication-authorization/dbms-administration.adoc#access-control-dbms-administration-user-management[User Management].
269335

270336
[source, Cypher]
271337
----
@@ -277,3 +343,11 @@ ALTER USER alice SET HOME DATABASE `remote-neo4j`
277343
Remote alias transactions will not be visible in `SHOW TRANSACTIONS` on **DBMS A**.
278344
However, they can be accessed and terminated on the remote database when connecting with the same user.
279345
====
346+
347+
[NOTE]
348+
====
349+
Action on the remote DBMS are all attributed to the user configured for the remote database alias.
350+
In the case of using `STORED NATIVE CREDENTIALS`, the same credentials are used to connect to the remote DBMS independent on which end-user made the query targeting the remote alias. This will result in the stored native user being logged in the audit trails on the remote DBMS for all queries using the remote database alias.
351+
When using `OIDC CREDENTIAL FORWARDING` the actual end-user´s credentials and permissions will be used, this will result in per-user audit trails being logged on the remote DBMS.
352+
====
353+

0 commit comments

Comments
 (0)