Skip to content

Commit 3e50c0f

Browse files
docs: updated and added OIDC credential forwarding
1 parent 99ac2ef commit 3e50c0f

File tree

2 files changed

+110
-18
lines changed

2 files changed

+110
-18
lines changed

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

Lines changed: 43 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -379,18 +379,23 @@ SHOW ALIAS `northwind-2022` FOR DATABASE YIELD name, properties
379379
[[alias-management-create-remote-database-alias]]
380380
=== Create database aliases for remote databases
381381

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.
383383
See xref:database-administration/aliases/remote-database-alias-configuration.adoc[] for the necessary configurations.
384384

385385
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.
386386
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.
387387
Alternatively, you can specify the version in the `CREATE ALIAS` or `ALTER ALIAS` commands.
388388
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.
389389

390+
When creating a remote database alias, the credentials used to target to the remote DBMS need to be specified. This can be done by providing the credentials of a native user, or
391+
by forwarding the OIDC credentials of the user logged in to the local DBMS.
392+
393+
To use the credentials of a native user on the remote DBMS, `USER` and `PASSWORD` need to be set when creating the alias.
394+
390395
.Query
391396
[source, cypher]
392397
----
393-
CREATE ALIAS `remote-northwind` FOR DATABASE `northwind-graph-2020`
398+
CREATE ALIAS `remote-northwind-stored-credentials` FOR DATABASE `northwind-graph-2020`
394399
AT "neo4j+s://location:7687"
395400
USER alice
396401
PASSWORD 'example_secret'
@@ -401,20 +406,50 @@ To view the remote database alias details, use the `SHOW ALIASES FOR DATABASE` c
401406
.Query
402407
[source, cypher]
403408
----
404-
SHOW ALIAS `remote-northwind`
409+
SHOW ALIAS `remote-northwind-stored-credentials`
410+
FOR DATABASE
411+
----
412+
413+
.Result
414+
[role="queryresult"]
415+
----
416+
+-----------------------------------------------------------------------------------------------------------------------------+
417+
| name | composite | database | location | url | user |
418+
+-----------------------------------------------------------------------------------------------------------------------------+
419+
| "remote-northwind-stored-credentilas" | NULL | "northwind-graph-2020" | "remote" | "neo4j+s://location:7687" | "alice" |
420+
+-----------------------------------------------------------------------------------------------------------------------------+
421+
----
422+
423+
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+
425+
.Query
426+
[source, cypher]
427+
----
428+
CREATE ALIAS `remote-northwind-oidc-credential-forwarding` FOR DATABASE `northwind-graph-2020`
429+
AT "neo4j+s://location:7687"
430+
OIDC CREDENTIAL FORWARDING
431+
----
432+
433+
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`.
434+
435+
.Query
436+
[source, cypher]
437+
----
438+
SHOW ALIAS `remote-northwind-oidc-credential-forwarding`
405439
FOR DATABASE
406440
----
407441

408442
.Result
409443
[role="queryresult"]
410444
----
411-
+----------------------------------------------------------------------------------------------------------+
412-
| name | composite | database | location | url | user |
413-
+----------------------------------------------------------------------------------------------------------+
414-
| "remote-northwind" | NULL | "northwind-graph-2020" | "remote" | "neo4j+s://location:7687" | "alice" |
415-
+----------------------------------------------------------------------------------------------------------+
445+
+-------------------------------------------------------------------------------------------------------------------------------------+
446+
| name | composite | database | location | url | user |
447+
+-------------------------------------------------------------------------------------------------------------------------------------+
448+
| "remote-northwind-oidc-credential-forwarding" | NULL | "northwind-graph-2020" | "remote" | "neo4j+s://location:7687" | NULL |
449+
+-------------------------------------------------------------------------------------------------------------------------------------+
416450
----
417451

452+
418453
You can also use `IF EXISTS` or `OR REPLACE` when creating remote database aliases.
419454
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.
420455
Both check for any remote or local database aliases (with `IF NOT EXISTS` also checking for databases).

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

Lines changed: 67 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,39 +14,41 @@ The following steps describe the setup required to define a remote database alia
1414
They are also useful should there be any changes in the name of the databases or the location of standalone servers and cluster instances.
1515
Additionally, you will also find information here on best practices and additional guidance on any changes in the configuration.
1616

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-
2317
A remote alias defines:
2418

2519
* Which user of the remote **DBMS B** is used.
2620
* Where the remote database is located.
2721
* How to connect to the remote database using driver settings.
2822
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.
24+
25+
== Setup example with stored native credentials
26+
27+
In this example, _Alice_ is an administrator and _Carol_ is a user who needs access to a database managed by _Bob_:
28+
29+
image::remote-alias-overview.svg[title="Overview of the required remote database alias setup when using stored credentials", role="middle"]
30+
31+
2932
[NOTE]
3033
====
3134
A remote database alias is only accessible to users with appropriate privileges.
3235
In the example above, _Bob_ is the administrator responsible for deciding which databases (`Db1` or `Db2`) the remote aliases can write and/or read.
3336
Meanwhile, _Alice_ is the administrator that assigns who has access to the privileges set by _Bob_.
3437
In the example, _Alice_ will assign that access to _Carol_.
3538
36-
See lxref:authentication-authorization/dbms-administration.adoc[DBMS privileges] for more information.
39+
See xref:authentication-authorization/dbms-administration.adoc[DBMS privileges] for more information.
3740
====
3841

3942
_Carol_ can use her own regular credentials to access the remote database `Db1` in DBMS after _Alice_ assigns this privilege to her user profile.
4043
This configuration will also allow _Carol_ to access `Db2` in **DBMS B**.
4144
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).
4245

43-
== Configure a remote DBMS (_Bob_)
46+
=== Configure a remote DBMS (_Bob_)
4447

4548
In the suggested example, there are two administrators: _Alice_ and _Bob_.
4649
_Bob_ is the administrator responsible for the setup of the remote DBMS, which includes the following steps:
4750

4851
. Create the user profile to share with _Alice_.
49-
Currently, only user and password-based authentication (e.g. native authentication) are supported.
5052
. Define the permissions for the user. If you don’t want this user to access `Db2`, here is where you set it.
5153
. Securely transmit the credentials to _Alice_, setting up the link to database `Db1`.
5254
It is recommended to create a custom role to track all users shared on a remote connection, so that they remain trackable.
@@ -79,7 +81,7 @@ server.bolt.tls_level=REQUIRED
7981
----
8082

8183
[[remote-alias-config-DBMS_admin-A]]
82-
== Configure a DBMS with a remote database alias (_Alice_)
84+
=== Configure a DBMS with a remote database alias (_Alice_)
8385

8486
As _Alice_, you need to generate an encryption key.
8587
In this case, the credentials of a user of **DBMS B** are reversibly encrypted and stored in the system database of **DBMS A**.
@@ -145,6 +147,61 @@ chmod 640 conf/neo4j.conf
145147
bin/neo4j start --expand-commands
146148
----
147149

150+
== Setup example with OIDC credential forwarding
151+
152+
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.
153+
154+
In this example, _Alice_ is an administrator and _Carol_ is a user who needs access to a database managed by _Bob_:
155+
156+
In the example above, _Carol_ logs in to *DBMS A* through an OIDC compliant identity provider by offering a token from the provider.
157+
The token is used to set the username and determine the identity provider groups of the user.
158+
_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 built-in roles and custom roles, such that _Carol_ can use the remote database alias to connect to the remote database `Db1`.
159+
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 built-in roles and custom roles such that the _Carol's_ identity provider groups gives the appropriate privileges to access `Db1` on the *DBMS B*.
160+
161+
162+
[CAUTION]
163+
====
164+
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.
165+
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].
166+
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.
167+
This configuration independence can lead to privilege inconsistency (e.g., over-privileging or unexpected access denial).
168+
====
169+
170+
=== Configure a remote DBMS (_Bob_)
171+
172+
173+
In the suggested example, there are two administrators: _Alice_ and _Bob_.
174+
_Bob_ is the administrator responsible for the setup of the remote DBMS, which includes the following steps:
175+
176+
. Set up SSO and support for the identity provider.
177+
. 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.
178+
179+
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.
180+
181+
[source, Example of additional configuration]
182+
----
183+
# accept non-local connections
184+
server.default_listen_address=0.0.0.0
185+
186+
# configure ssl for bolt
187+
dbms.ssl.policy.bolt.enabled=true
188+
dbms.ssl.policy.bolt.base_directory=certificates/bolt
189+
dbms.ssl.policy.bolt.private_key=private.key
190+
dbms.ssl.policy.bolt.public_certificate=public.crt
191+
dbms.ssl.policy.bolt.client_auth=NONE
192+
193+
# enforcing ssl connection
194+
server.bolt.tls_level=REQUIRED
195+
----
196+
197+
=== Configure a DBMS with a remote database alias (_Alice_)
198+
199+
The steps _Alice_, need to take are:
200+
201+
. Set up SSO and support for the identity provider.
202+
. Map the identity provider groups to the Neo4j roles. This is where the permission to use the remote database alias is set.
203+
204+
148205
== Manage remote database aliases
149206

150207
You can use the xref:database-administration/aliases/manage-aliases-standard-databases.adoc[alias commands] to manage remote database aliases.

0 commit comments

Comments
 (0)