You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: modules/ROOT/pages/database-administration/aliases/manage-aliases-standard-databases.adoc
+46-8Lines changed: 46 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -379,18 +379,25 @@ SHOW ALIAS `northwind-2022` FOR DATABASE YIELD name, properties
379
379
[[alias-management-create-remote-database-alias]]
380
380
=== Create database aliases for remote databases
381
381
382
-
A database alias can target a remote database by providing an URL and the credentials of a user on the remote Neo4j DBMS.
382
+
A database alias can target a remote database by providing a URL and the credentials of a user on the remote Neo4j DBMS.
383
383
See xref:database-administration/aliases/remote-database-alias-configuration.adoc[] for the necessary configurations.
384
384
385
385
Since remote database aliases target databases that are not in this DBMS, they do not fetch the default Cypher version from their target like the local database aliases.
386
386
Instead, they are assigned the version given by xref:configuration/configuration-settings.adoc#config_db.query.default_language[`db.query.default_language`], which is set in the `neo4j.conf` file.
387
387
Alternatively, you can specify the version in the `CREATE ALIAS` or `ALTER ALIAS` commands.
388
388
See xref:database-administration/aliases/manage-aliases-standard-databases.adoc#set-default-language-for-remote-database-aliases[] and xref:database-administration/aliases/manage-aliases-standard-databases.adoc#alter-default-language-remote-database-alias[] for more information.
389
389
390
+
When creating a remote database alias, the credentials used to target to the remote DBMS need to be specified and can be either:
391
+
392
+
* `STORED NATIVE CREDENTIALS`, using the credentials of a single native user on the remote DBMS.
393
+
* `OIDC CREDENTIAL FORWARDING`, forwarding the bearer authentication token from the logged-in user on the local DBMS. The user needs to be logged in with an identity provider supporting OIDC. label:new[Introduced in 2025.10]
394
+
395
+
To use the credentials of a native user on the remote DBMS, `USER` and `PASSWORD` need to be set when creating the alias.
396
+
390
397
.Query
391
398
[source, cypher]
392
399
----
393
-
CREATE ALIAS `remote-northwind` FOR DATABASE `northwind-graph-2020`
400
+
CREATE ALIAS `remote-northwind-stored-credentials` FOR DATABASE `northwind-graph-2020`
394
401
AT "neo4j+s://location:7687"
395
402
USER alice
396
403
PASSWORD 'example_secret'
@@ -401,20 +408,51 @@ To view the remote database alias details, use the `SHOW ALIASES FOR DATABASE` c
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.
426
+
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.
427
+
428
+
.Query
429
+
[source, cypher]
430
+
----
431
+
CREATE ALIAS `remote-northwind-oidc-credential-forwarding` FOR DATABASE `northwind-graph-2020`
432
+
AT "neo4j+s://location:7687"
433
+
OIDC CREDENTIAL FORWARDING
416
434
----
417
435
436
+
Since the alias use the credentials of the logged-in user when targeting the remote DBMS, there are no stored credentials and user will be `NULL`.
437
+
438
+
.Query
439
+
[source, cypher]
440
+
----
441
+
SHOW ALIAS `remote-northwind-oidc-credential-forwarding`
You can also use `IF EXISTS` or `OR REPLACE` when creating remote database aliases.
419
457
It works the same way as described in the <<_use_if_exists_or_or_replace_when_creating_database_aliases, Use `IF EXISTS` or `OR REPLACE` when creating database aliases>> section.
420
458
Both check for any remote or local database aliases (with `IF NOT EXISTS` also checking for databases).
@@ -14,39 +14,46 @@ The following steps describe the setup required to define a remote database alia
14
14
They are also useful should there be any changes in the name of the databases or the location of standalone servers and cluster instances.
15
15
Additionally, you will also find information here on best practices and additional guidance on any changes in the configuration.
16
16
17
-
== Setup example
18
-
19
-
In this example, _Alice_ is an administrator and _Carol_ is a user who needs access to a database managed by _Bob_:
20
-
21
-
image::remote-alias-overview.svg[title="Overview of the required remote database alias setup", role="middle"]
22
-
23
17
A remote alias defines:
24
18
25
19
* Which user of the remote **DBMS B** is used.
26
20
* Where the remote database is located.
27
21
* How to connect to the remote database using driver settings.
28
22
23
+
When creating the remote database alias, it can be configured to authenticate with either:
24
+
25
+
* `STORED NATIVE CREDENTIALS`, the credentials of a single native user on the remote **DBMS B**.
26
+
* `OIDC CREDENTIAL FORWARDING`, forwarding the bearer authentication token from the logged-in user on the local **DBMS A**. The user needs to be logged in with an identity provider supporting OIDC. label:new[Introduced in 2025.10]
27
+
28
+
29
+
[[setup-example-stored-native-credentials]]
30
+
== Setup example with stored native credentials
31
+
32
+
In this example, _Alice_ is an administrator and _Carol_ is a user who needs access to a database managed by _Bob_:
33
+
34
+
image::remote-alias-overview.svg[title="Overview of the required remote database alias setup when using stored credentials", role="middle"]
35
+
36
+
29
37
[NOTE]
30
38
====
31
39
A remote database alias is only accessible to users with appropriate privileges.
32
40
In the example above, _Bob_ is the administrator responsible for deciding which databases (`Db1` or `Db2`) the remote aliases can write and/or read.
33
41
Meanwhile, _Alice_ is the administrator that assigns who has access to the privileges set by _Bob_.
34
42
In the example, _Alice_ will assign that access to _Carol_.
35
43
36
-
See lxref:authentication-authorization/dbms-administration.adoc[DBMS privileges] for more information.
44
+
See xref:authentication-authorization/dbms-administration.adoc[DBMS privileges] for more information.
37
45
====
38
46
39
47
_Carol_ can use her own regular credentials to access the remote database `Db1` in DBMS after _Alice_ assigns this privilege to her user profile.
40
48
This configuration will also allow _Carol_ to access `Db2` in **DBMS B**.
41
49
If the administrators decide this should not be the case, then _Bob_ must define the appropriate privileges (see xref:authentication-authorization/index.adoc[Authentication and authorization] for further information).
42
50
43
-
== Configure a remote DBMS (_Bob_)
51
+
=== Configure a remote DBMS (_Bob_)
44
52
45
53
In the suggested example, there are two administrators: _Alice_ and _Bob_.
46
54
_Bob_ is the administrator responsible for the setup of the remote DBMS, which includes the following steps:
47
55
48
56
. Create the user profile to share with _Alice_.
49
-
Currently, only user and password-based authentication (e.g. native authentication) are supported.
50
57
. Define the permissions for the user. If you don’t want this user to access `Db2`, here is where you set it.
51
58
. Securely transmit the credentials to _Alice_, setting up the link to database `Db1`.
52
59
It is recommended to create a custom role to track all users shared on a remote connection, so that they remain trackable.
@@ -79,7 +86,7 @@ server.bolt.tls_level=REQUIRED
79
86
----
80
87
81
88
[[remote-alias-config-DBMS_admin-A]]
82
-
== Configure a DBMS with a remote database alias (_Alice_)
89
+
=== Configure a DBMS with a remote database alias (_Alice_)
83
90
84
91
As _Alice_, you need to generate an encryption key.
85
92
In this case, the credentials of a user of **DBMS B** are reversibly encrypted and stored in the system database of **DBMS A**.
@@ -145,7 +152,7 @@ chmod 640 conf/neo4j.conf
145
152
bin/neo4j start --expand-commands
146
153
----
147
154
148
-
== Manage remote database aliases
155
+
=== Manage remote database aliases
149
156
150
157
You can use the xref:database-administration/aliases/manage-aliases-standard-databases.adoc[alias commands] to manage remote database aliases.
151
158
In this case, it is strongly recommended to connect to a remote database alias with a secured connection.
@@ -154,15 +161,15 @@ Please note that only client-side SSL is supported.
154
161
By default, remote aliases require a secured URI scheme such as `neo4j+s`.
155
162
This can be disabled by setting the driver setting `ssl_enforced` to `false`.
156
163
157
-
For example, the following command can be used to create a remote database alias:
164
+
For example, the following command can be used to create a remote database alias with stored native credentials:
158
165
159
166
[source, Cypher]
160
167
----
161
168
CREATE ALIAS `remote-neo4j` FOR DATABASE `neo4j` AT "neo4j+s://location:7687" USER alice PASSWORD 'secretpassword'
162
169
----
163
170
164
-
In order to do so, either lxref:authentication-authorization/dbms-administration.adoc#access-control-dbms-administration-database-management[database management]
165
-
or lxref:authentication-authorization/dbms-administration.adoc#access-control-dbms-administration-alias-management[alias management] privileges are required.
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.
166
173
The permission to create an alias can be granted like this:
167
174
168
175
[source, Cypher]
@@ -183,7 +190,7 @@ If a transaction modifies an alias (e.g. changing the database targeted on **DBM
183
190
This prevents issues such as a transaction executing against multiple target databases for the same alias.
184
191
====
185
192
186
-
== Change the encryption key
193
+
=== Change the encryption key
187
194
188
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.
189
196
@@ -193,6 +200,120 @@ If there is a failure when reading the keystore file, investigate the `debug.log
193
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.
194
201
====
195
202
203
+
[role=label--new-2025.10]
204
+
[[setup-example-credential-forwarding]]
205
+
== Setup example with OIDC credential forwarding
206
+
207
+
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.
208
+
209
+
In this example, _Alice_ is an administrator and _Carol_ is a user who needs access to a database managed by _Bob_:
210
+
211
+
In the example above, _Carol_ logs in to *DBMS A* through an OIDC compliant identity provider by offering a token from the provider.
212
+
The token is used to set the username and determine the identity provider groups of the user.
213
+
_Alice_ is the admin of *DBMS A* and has set up SSO for the identity provider and configured the mapping of the identity provider groups to the Neo4j roles, such that _Carol_ can use the remote database alias to connect to the remote database `Db1`.
214
+
Additionally, _Bob_ needs to configure the *DBMS B* to support SSO with the same identity provider used by _Carol_ to log in to *DBMS A*. _Bob_ also needs to configure the mapping of the identity provider groups to the Neo4j roles such that the _Carol's_ identity provider groups gives the appropriate privileges to access `Db1` on the *DBMS B*.
215
+
216
+
217
+
[CAUTION]
218
+
====
219
+
While it is permitted to use different OIDC configurations across distinct DBMS instances (e.g., local vs. target), users must be aware of the resulting privilege disparity.
220
+
A user's effective permissions are not dictated by the identity provider groups alone, but by the mapping of those groups to the roles defined within each specific Neo4j DBMS, see xref:authentication-authorization/sso-integration.adoc#auth-sso-map-idp-roles[Map the identity provider groups to the Neo4j roles].
221
+
Crucially, if the OIDC configuration settings differ between the local DBMS and the target DBMS, the user will have different effective privileges on those systems.
222
+
This configuration independence can lead to privilege inconsistency (e.g., over-privileging or unexpected access denial).
223
+
====
224
+
225
+
=== Configure a remote DBMS (_Bob_)
226
+
227
+
228
+
In the suggested example, there are two administrators: _Alice_ and _Bob_.
229
+
_Bob_ is the administrator responsible for the setup of the remote DBMS, which includes the following steps:
230
+
231
+
. Set up SSO and support for the identity provider.
232
+
. Map the identity provider groups to the Neo4j roles. If you don’t want specific users to access `Db2`, here is where you set it.
233
+
234
+
Additionally, _Bob_ must do the required setup for the link:https://neo4j.com/docs/operations-manual/current/security/ssl-framework/[SSL framework] and check whether the database accepts a non-local connection if required.
You can use the xref:database-administration/aliases/manage-aliases-standard-databases.adoc[alias commands] to manage remote database aliases.
278
+
In this case, it is strongly recommended to connect to a remote database alias with a secured connection.
279
+
280
+
Please note that only client-side SSL is supported.
281
+
By default, remote aliases require a secured URI scheme such as `neo4j+s`.
282
+
This can be disabled by setting the driver setting `ssl_enforced` to `false`.
283
+
284
+
For example, the following command can be used to create a remote database alias with OIDC credential forwarding:
285
+
286
+
[source, Cypher]
287
+
----
288
+
CREATE ALIAS `remote-neo4j` FOR DATABASE `neo4j` AT "neo4j+s://location:7687" OIDC CREDENTIAL FORWARDING
289
+
----
290
+
291
+
In order to do so, either xref:authentication-authorization/dbms-administration.adoc#access-control-dbms-administration-database-management[database management]
292
+
or xref:authentication-authorization/dbms-administration.adoc#access-control-dbms-administration-alias-management[alias management] privileges are required.
293
+
The permission to create an alias can be granted like this:
294
+
295
+
[source, Cypher]
296
+
----
297
+
GRANT CREATE ALIAS ON DBMS TO administrator
298
+
----
299
+
300
+
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:
301
+
302
+
[source, Cypher]
303
+
----
304
+
GRANT ACCESS ON DATABASE `remote-neo4j` TO admin
305
+
----
306
+
307
+
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`.
308
+
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].
309
+
310
+
[NOTE]
311
+
====
312
+
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.
313
+
This prevents issues such as a transaction executing against multiple target databases for the same alias.
314
+
====
315
+
316
+
196
317
== Connect to remote database aliases
197
318
198
319
A user can connect to a remote database alias the same way they would do to a database.
@@ -208,7 +329,7 @@ USE `remote-neo4j` MATCH (n) RETURN *
208
329
209
330
* Connecting to a remote database alias as a home database.
210
331
This needs to be set by Administrator A.
211
-
See more about lxref:authentication-authorization/dbms-administration.adoc#access-control-dbms-administration-user-management[User Management].
332
+
See more about xref:authentication-authorization/dbms-administration.adoc#access-control-dbms-administration-user-management[User Management].
212
333
213
334
[source, Cypher]
214
335
----
@@ -220,3 +341,15 @@ ALTER USER alice SET HOME DATABASE `remote-neo4j`
220
341
Remote alias transactions will not be visible in `SHOW TRANSACTIONS` on **DBMS A**.
221
342
However, they can be accessed and terminated on the remote database when connecting with the same user.
222
343
====
344
+
345
+
[NOTE]
346
+
====
347
+
Action on the remote DBMS are all attributed to the user configured for the remote database alias.
348
+
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.
349
+
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.
350
+
====
351
+
352
+
[NOTE]
353
+
====
354
+
When using a remote database alias with OIDC credential forwarding, the user needs to be logged in to the local DBMS with OIDC, otherwise there is no token to forward and the access to the remote database will be denied with `GQLSTATUS 42NFF`.
0 commit comments