|
3 | 3 | = LDAP integration |
4 | 4 | :description: This page describes Neo4j support for integrating with LDAP systems. |
5 | 5 |
|
6 | | -This page describes Neo4j support for integrating with LDAP systems. |
7 | | -The following topics are covered: |
8 | | - |
9 | | -* xref:authentication-authorization/ldap-integration.adoc#auth-ldap-introduction[Introduction] |
10 | | -* xref:authentication-authorization/ldap-integration.adoc#auth-ldap-parameters[LDAP configuration parameters] |
11 | | -* xref:authentication-authorization/ldap-integration.adoc#auth-ldap-configure-provider[Set Neo4j to use LDAP] |
12 | | -* xref:authentication-authorization/ldap-integration.adoc#auth-ldap-map-ldap-roles[Map the LDAP groups to the Neo4j roles] |
13 | | -* xref:authentication-authorization/ldap-integration.adoc#auth-ldap-configure-provider-ad[Configure Neo4j to use Active Directory] |
14 | | -** xref:authentication-authorization/ldap-integration.adoc#auth-ldap-configure-provider-ad-uid[Configure Neo4j to support LDAP user ID authentication] |
15 | | -** xref:authentication-authorization/ldap-integration.adoc#auth-ldap-configure-provider-ad-sysaccount[Configure Neo4j to support attribute authentication] |
16 | | -** xref:authentication-authorization/ldap-integration.adoc#auth-ldap-configure-provider-ad-nosysaccount[Configure Neo4j to support `sAMAccountName` authentication by setting `user_dn_template`] |
17 | | -** xref:authentication-authorization/ldap-integration.adoc#auth-ldap-configure-nested-groups[Configure Neo4j to perform nested group lookup] |
18 | | -* xref:authentication-authorization/ldap-integration.adoc#auth-ldap-configure-provider-openldap[Configure Neo4j to use OpenLDAP] |
19 | | -* xref:authentication-authorization/ldap-integration.adoc#auth-ldap-search[Verify the LDAP configuration] |
20 | | -* xref:authentication-authorization/ldap-integration.adoc#auth-ldap-clear-auth-cache[The auth cache] |
21 | | -* xref:authentication-authorization/ldap-integration.adoc#auth-ldap-ad-encrypted[Available methods of encryption] |
22 | | -** xref:authentication-authorization/ldap-integration.adoc#auth-ldap-encrypted-starttls[Use LDAP with encryption via StartTLS] |
23 | | -** xref:authentication-authorization/ldap-integration.adoc#auth-ldap-encrypted-ldaps[Use LDAP with encrypted LDAPS] |
24 | | -* xref:authentication-authorization/ldap-integration.adoc#auth-ldap-self-signed-certificate[Use a self-signed certificate (SSL) in a test environment] |
25 | | - |
26 | | - |
27 | | -[[auth-ldap-introduction]] |
28 | | -== Introduction |
29 | | - |
30 | 6 | Neo4j supports LDAP, which allows for integration with Active Directory (AD), OpenLDAP, or other LDAP-compatible authentication services. |
31 | 7 | This means that you use the LDAP service for managing federated users, while the native Neo4j user and role administration are completely turned off. |
32 | 8 |
|
@@ -104,7 +80,7 @@ This way, the LDAP connector is used as a security provider for both authenticat |
104 | 80 | If you want, you can still use the `native` provider for mixed-mode authentication and authorization. |
105 | 81 | The values are comma-separated and queried in the declared order. |
106 | 82 | + |
107 | | -.Configure Neo4j to use LDAP and the native authentication and authorization provider. |
| 83 | +.Configure Neo4j to use LDAP and the native authentication and authorization provider |
108 | 84 | ====== |
109 | 85 | [source,configuration,role="noheader"] |
110 | 86 | ---- |
@@ -358,6 +334,136 @@ dbms.security.ldap.authorization.access_permitted_group=501 |
358 | 334 | . Map the groups in the LDAP system to the Neo4j built-in and custom roles. |
359 | 335 | For more information, see xref:authentication-authorization/ldap-integration.adoc#auth-ldap-map-ldap-roles[Map the LDAP groups to the Neo4j roles]. |
360 | 336 |
|
| 337 | +[role=label--new-5.24] |
| 338 | +[[auth-ldap-auth-providers]] |
| 339 | +== Configure authentication/authorization at the user level using auth providers |
| 340 | +xref:authentication-authorization/auth-providers.adoc[User auth providers] can be used to determine which users can authenticate and authorize using the configured providers, including LDAP. |
| 341 | + |
| 342 | +You must change the xref:configuration/configuration-settings.adoc#config_dbms.security.require_local_user[`dbms.security.require_local_user`] configuration setting to `true` to use auth providers. |
| 343 | +This means that a user with a matching auth provider *must* exist in order to be able to authenticate and authorize. |
| 344 | +This applies to all providers. |
| 345 | + |
| 346 | +Conversely, when xref:configuration/configuration-settings.adoc#config_dbms.security.require_local_user[`dbms.security.require_local_user`] is set to `false`, users' auth providers have no bearing on the way that they are authenticated and authorized, instead authentication and authorization is controlled centrally (for all users) by the database configuration. |
| 347 | + |
| 348 | +The following examples show how to configure users with auth provider `ldap` using Cypher. |
| 349 | + |
| 350 | +.Create a user with an auth provider who can authenticate and authorize using `LDAP` |
| 351 | +====== |
| 352 | +[source,cypher,role=noplay] |
| 353 | +---- |
| 354 | +CREATE USER alice |
| 355 | +SET AUTH PROVIDER 'ldap' { SET ID 'cn=alice,ou=engineering,dc=example,dc=com' } |
| 356 | +---- |
| 357 | +
|
| 358 | +The command creates the user `alice` who can authenticate and authorize using LDAP provided their LDAP `dn` is `cn=alice,ou=engineering,dc=example,dc=com`. |
| 359 | +====== |
| 360 | + |
| 361 | +.Create a user with two auth providers allowing the user to authenticate and authorize with either LDAP or the `mysso` provider |
| 362 | +====== |
| 363 | +
|
| 364 | +[source,cypher,role=noplay] |
| 365 | +---- |
| 366 | +CREATE USER alice |
| 367 | +SET HOME DATABASE anotherDb |
| 368 | +SET AUTH PROVIDER 'ldap' { SET ID 'cn=alice,ou=engineering,dc=example,dc=com' } |
| 369 | +SET AUTH 'oidc-mysso' {SET ID 'alicesUniqueMySsoId'} |
| 370 | +---- |
| 371 | +
|
| 372 | +The command creates the user `alice` who can authenticate and authorize using `ldap` or `mysso`. |
| 373 | +See xref:authentication-authorization/sso-integration.adoc#auth-sso-auth-providers[Configure SSO at the user level using auth providers] for more information on setting up an OIDC provider. |
| 374 | +The example also illustrates that the user can have their home database set even when using only external auth providers. |
| 375 | +====== |
| 376 | + |
| 377 | +.Alter a user to remove one of their auth providers |
| 378 | +====== |
| 379 | +
|
| 380 | +[source,cypher,role=noplay] |
| 381 | +---- |
| 382 | +ALTER USER alice |
| 383 | +REMOVE AUTH 'ldap' |
| 384 | +---- |
| 385 | +
|
| 386 | +The command prevents the user `alice` from being able to authenticate and authorize using `ldap`. |
| 387 | +====== |
| 388 | + |
| 389 | +.Alter a user to allow them to authenticate and authorize using username and password |
| 390 | +====== |
| 391 | +
|
| 392 | +[source,cypher,role=noplay] |
| 393 | +---- |
| 394 | +ALTER USER alice |
| 395 | +SET AUTH 'native' {SET PASSWORD 'changeme' SET PASSWORD CHANGE REQUIRED} |
| 396 | +---- |
| 397 | +
|
| 398 | +The command allows the user `alice` to authenticate and authorize using the specified username and password (in addition to what they are already configured to use). |
| 399 | +====== |
| 400 | + |
| 401 | + |
| 402 | +.Configure the database to allow authentication via `ldap` and authorization via the `native` provider |
| 403 | +====== |
| 404 | +
|
| 405 | +. Set the following database config: |
| 406 | ++ |
| 407 | +[source, properties] |
| 408 | +---- |
| 409 | +dbms.security.authentication_providers=ldap |
| 410 | +dbms.security.authorization_providers=native |
| 411 | +---- |
| 412 | +
|
| 413 | +. Create a user with an `ldap` auth provider: |
| 414 | ++ |
| 415 | +[source,cypher,role=noplay] |
| 416 | +---- |
| 417 | +CREATE USER alice |
| 418 | +SET AUTH PROVIDER 'ldap' { SET ID 'cn=alice,ou=engineering,dc=example,dc=com' } |
| 419 | +---- |
| 420 | +
|
| 421 | +. Natively grant the `READER` role to the user: |
| 422 | ++ |
| 423 | +[source,cypher,role=noplay] |
| 424 | +---- |
| 425 | +GRANT ROLE READER TO alice |
| 426 | +---- |
| 427 | ++ |
| 428 | +The command allows the user `alice` to authenticate using `ldap` and receive the `READER` role from the `native` provider. |
| 429 | +
|
| 430 | +. You can also give the user the union of roles from `ldap` *and* `native` roles by setting `ldap` as an authorization provider too: |
| 431 | ++ |
| 432 | +[source, properties] |
| 433 | +---- |
| 434 | +dbms.security.authentication_providers=ldap |
| 435 | +dbms.security.authorization_providers=native,ldap |
| 436 | +---- |
| 437 | +====== |
| 438 | + |
| 439 | +.Suspend a user |
| 440 | +====== |
| 441 | +[source,cypher,role=noplay] |
| 442 | +---- |
| 443 | +ALTER USER alice |
| 444 | +SET STATUS SUSPENDED |
| 445 | +
|
| 446 | +---- |
| 447 | +The command completely prevents the user from being able to authenticate/authorize by any means. |
| 448 | +====== |
| 449 | + |
| 450 | +.Disambiguate users with the same name in different LDAP trees |
| 451 | +====== |
| 452 | +
|
| 453 | +Suppose there are two users both with the name `alice`, one is part of the `engineering` tree (`cn=alice,ou=engineering,dc=example,dc=com`) and the other is part of the `sales` tree (`cn=alice,ou=sales,dc=example,dc=com`). |
| 454 | +
|
| 455 | +To disambiguate these users, you can create two users in the database, each with a different `ID` that corresponds to the `dn` of the user in the LDAP tree. |
| 456 | +
|
| 457 | +[source,cypher,role=noplay] |
| 458 | +---- |
| 459 | +CREATE USER aliceEngineering |
| 460 | +SET AUTH 'ldap' { SET ID 'cn=alice,ou=engineering,dc=example,dc=com' } |
| 461 | +
|
| 462 | +CREATE USER aliceSales |
| 463 | +SET AUTH 'ldap' { SET ID 'cn=alice,ou=sales,dc=example,dc=com' } |
| 464 | +---- |
| 465 | +====== |
| 466 | + |
361 | 467 | [[auth-ldap-search]] |
362 | 468 | == Verify the LDAP configuration |
363 | 469 |
|
|
0 commit comments