keycloak-scim/server_admin/topics/user-federation/ldap.adoc

133 lines
8.6 KiB
Text
Raw Normal View History

2016-05-31 15:17:46 +00:00
[[_ldap]]
2016-05-30 19:29:32 +00:00
2016-05-31 15:17:46 +00:00
=== LDAP and Active Directory
2016-05-30 19:29:32 +00:00
{{book.project.name}} comes with a built-in LDAP/AD plugin.
By default, it is set up only to import username, email, first name, and last name. But you are free to configure additional <<_ldap_mappers,mappers>>
2016-05-30 19:29:32 +00:00
and add more attributes or delete the default ones.
It supports password validation via LDAP/AD protocols and different user metadata synchronization modes.
To configure a federated LDAP store go to the Admin Console.
Click on the `User Federation` left menu option.
2016-05-31 15:24:58 +00:00
When you get to this page there is an `Add Provider` select box.
2016-05-30 19:29:32 +00:00
You should see _ldap_ within this list.
Selecting _ldap_ will bring you to the ldap configuration page.
==== Edit Mode
2016-06-03 05:32:47 +00:00
Users, through the <<fake/../../account.adoc#_account-service, User Account Service>>, and admins through the Admin Console
2016-05-31 15:24:58 +00:00
have the ability to modify user metadata. Depending on your setup you may or may not have LDAP update privileges. The
`Edit Mode` configuration option defines the edit policy you have with your LDAP store.
2016-05-30 19:29:32 +00:00
READONLY::
Username, email, first name, last name, and other mapped attributes will be unchangeable.
2016-05-30 19:29:32 +00:00
{{book.project.name}} will show an error anytime anybody tries to update these fields.
2016-12-02 15:59:53 +00:00
Also, password updates will not be supported.
2016-05-30 19:29:32 +00:00
WRITABLE::
2016-12-02 15:59:53 +00:00
Username, email, first name, last name, and other mapped attributes and passwords can all be updated and will be synchronized automatically with your LDAP store.
2016-05-30 19:29:32 +00:00
UNSYNCED::
Any changes to username, email, first name, last name, and passwords will be stored in {{book.project.name}} local storage.
2016-05-31 15:24:58 +00:00
It is up to you to figure out how to synchronize back to LDAP. This allows {{book.project.name}} deployments to support
updates of user metadata on a read-only LDAP server.
2016-05-30 19:29:32 +00:00
==== Other config options
Console Display Name::
2016-12-02 15:59:53 +00:00
Name used when this provider is referenced in the admin console
2016-05-30 19:29:32 +00:00
Priority::
2016-12-02 15:59:53 +00:00
The priority of this provider when looking up users or for adding registrations.
2016-05-30 19:29:32 +00:00
Sync Registrations::
2016-12-02 15:59:53 +00:00
If a new user is added through a registration page or admin console, should the user be eligible to be synchronized to this provider?
2016-05-30 19:29:32 +00:00
Allow Kerberos authentication::
Enable Kerberos/SPNEGO authentication in realm with users data provisioned from LDAP.
More info in <<fake/../../authentication/kerberos.adoc#_kerberos,Kerberos section>>.
Other options::
The rest of the configuration options should be self explanatory.
You can mouseover the tooltips in Admin Console to see some more details about them.
==== Connect to LDAP over SSL
When you configure a secured connection URL to your LDAP store(for example `ldaps://myhost.com:636` ),
{{book.project.name}} will use SSL for the communication with LDAP server.
The important thing is to properly configure a truststore on the {{book.project.name}} server side, otherwise {{book.project.name}} can't trust the SSL connection to LDAP.
2016-05-30 19:29:32 +00:00
The global truststore for the {{book.project.name}} can be configured with the Truststore SPI. Please check out the link:{{book.installguide.link}}[{{book.installguide.name}}] for more detail.
If you don't configure the truststore SPI, the truststore will fallback to the default mechanism provided by Java (either the file provided by system property `javax.net.ssl.trustStore`
or the cacerts file from the JDK if the system property is not set).
2016-05-30 19:29:32 +00:00
There is a configuration property `Use Truststore SPI` in the LDAP federation provider configuration, where you can choose whether the Truststore SPI is used.
By default, the value is `Only for ldaps`, which is fine for most deployments. The Truststore SPI will only be used
2016-05-30 19:29:32 +00:00
if the connection to LDAP starts with `ldaps`.
==== Sync of LDAP users to {{book.project.name}}
LDAP Federation Provider will automatically take care of synchronization (import) of needed LDAP users into the {{book.project.name}} local database.
As users log in, the LDAP Federation provider will import the LDAP user
into the {{book.project.name}} database and then authenticate against the LDAP password. This is the only time users will be imported.
2016-06-01 13:12:51 +00:00
If you go to the `Users` left menu item in the Admin Console and click the `View all users` button, you will only see those LDAP users that
have been authenticated at least once by {{book.project.name}}. It is implemented this way so that admins don't accidentally try to import a huge LDAP DB of users.
2016-05-30 19:29:32 +00:00
If you want to sync all LDAP users into the {{book.project.name}} database, you may configure and enable the `Sync Settings` of the LDAP provider you configured.
2016-06-01 13:12:51 +00:00
There are 2 types of synchronization:
2016-05-30 19:29:32 +00:00
Periodic Full sync::
This will synchronize all LDAP users into {{book.project.name}} DB.
Those LDAP users, which already exist in {{book.project.name}} and were changed in LDAP directly will be updated in {{book.project.name}} DB
(For example if user `Mary Kelly` was changed in LDAP to `Mary Smith`).
Periodic Changed users sync::
2016-06-01 13:12:51 +00:00
When syncing occurs, only those users that were created or updated after the last sync will be updated and/or imported.
2016-05-30 19:29:32 +00:00
2016-06-01 13:12:51 +00:00
The best way to handle syncing is to click the `Synchronize all users` button when you first create the LDAP provider,
then set up a periodic sync of changed users. The configuration page for your LDAP Provider has several options to support you.
2016-05-30 19:29:32 +00:00
[[_ldap_mappers]]
==== LDAP/Federation mappers
LDAP mappers are `listeners`, which are triggered by the LDAP Federation provider at various points, provide another extension point to LDAP integration.
They are triggered when a user logs in via LDAP and needs to be imported, during {{book.project.name}} initiated registration, or when a user is queried from the Admin Console.
2016-12-02 15:59:53 +00:00
When you create an LDAP Federation provider, {{book.project.name}} will automatically provide set of built-in `mappers` for this provider.
You are free to change this set and create a new mapper or update/delete existing ones.
2016-05-30 19:29:32 +00:00
User Attribute Mapper::
This allows you to specify which LDAP attribute is mapped to which attribute of {{book.project.name}} user.
So, for example, you can configure that LDAP attribute `mail` to the attribute `email` in the {{book.project.name}} database.
For this mapper implementation, there is always a one-to-one mapping (one LDAP attribute is mapped to one {{book.project.name}} attribute)
2016-05-30 19:29:32 +00:00
FullName Mapper::
This allows you to specify that the full name of the user, which is saved in some LDAP attribute (usually `cn` ) will be mapped to `firstName` and `lastname` attributes in the {{book.project.name}} database.
2016-12-02 15:59:53 +00:00
Having `cn` to contain full name of user is a common case for some LDAP deployments.
2016-05-30 19:29:32 +00:00
Role Mapper::
This allows you to configure role mappings from LDAP into {{book.project.name}} role mappings.
One Role mapper can be used to map LDAP roles (usually groups from a particular branch of LDAP tree) into roles corresponding to either realm roles or client roles of a specified client.
It's not a problem to configure more Role mappers for the same LDAP provider.
2016-05-30 19:29:32 +00:00
So for example you can specify that role mappings from groups under
`ou=main,dc=example,dc=org` will be mapped to realm role mappings and role mappings from groups under
`ou=finance,dc=example,dc=org` will be mapped to client role mappings of client `finance` .
Hardcoded Role Mapper::
This mapper will grant a specified {{book.project.name}} role to each {{book.project.name}} user linked with LDAP.
2016-05-30 19:29:32 +00:00
Group Mapper::
This allows you to configure group mappings from LDAP into {{book.project.name}} group mappings.
Group mapper can be used to map LDAP groups from a particular branch of an LDAP tree into groups in {{book.project.name}}.
It will also propagate user-group mappings from LDAP into user-group mappings in {{book.project.name}}.
2016-05-30 19:29:32 +00:00
MSAD User Account Mapper::
This mapper is specific to Microsoft Active Directory (MSAD). It's able to tightly integrate the MSAD user account state
into the {{book.project.name}} account state (account enabled, password is expired etc).
It's using the `userAccountControl` and `pwdLastSet` LDAP attributes. (both are specific to MSAD and are not LDAP standard).
For example if `pwdLastSet` is `0`, the {{book.project.name}} user is required to update their password
and there will be an UPDATE_PASSWORD required action added to the user. If `userAccountControl` is
2016-05-30 19:29:32 +00:00
`514` (disabled account) the {{book.project.name}} user is disabled as well.
By default, there is set of User Attribute mappers that map basic {{book.project.name}} user attributes like username, first name, lastname, and email to corresponding LDAP attributes.
2016-05-30 19:29:32 +00:00
You are free to extend these and provide additional attribute mappings.
2016-12-02 15:59:53 +00:00
Admin console provides tooltips, which should help with configuring the corresponding mappers.