Keycloak LDAP and Active Directory federation over LDAPS

TL;DR

Keycloak can use an LDAP directory, OpenLDAP or Microsoft Active Directory, as its source of truth for users: accounts, attributes, groups and passwords stay in the directory, and Keycloak checks every password against it with an LDAP bind. This feature is called user federation.

Since every login sends a user’s password to the directory, the connection must be encrypted. The clean way to do it:

  1. get the certificate of the CA that signed the directory’s certificate;
  2. hand it to Keycloak with the truststore-paths option (KC_TRUSTSTORE_PATHS), or drop it in conf/truststores/;
  3. create an LDAP provider with a ldaps:// connection URL whose host name appears in the directory certificate;
  4. pick the edit mode (READ_ONLY, UNSYNCED or WRITABLE), the synchronisation periods and the group mappers.

On the Keycloak as a Service of Clever Cloud, the same CA certificate goes into the add-on’s FS Bucket, and a Network Group (a WireGuard tunnel) lets a Keycloak hosted in the cloud reach a directory that never leaves your premises.

Every behaviour described below was reproduced on Keycloak 26.8.2 with an OpenLDAP directory: see Tested for real.


What “LDAP as the source of truth” means in Keycloak

With an LDAP provider configured, Keycloak looks up any user it does not know in the directory, imports a local copy of the account (unless import is disabled) and links it to the directory entry. From then on:

  • the password never leaves the directory: Keycloak does not store it, it opens an LDAP connection and binds as the user to check it;
  • the directory decides who exists: an account deleted from the directory can no longer sign in, even before the next synchronisation;
  • Keycloak adds what the directory lacks: OIDC and SAML for your applications, second factors, sessions, consents, social login.
sequenceDiagram
    participant U as User
    participant K as Keycloak
    participant L as LDAP / Active Directory
    U->>K: username + password (login form)
    K->>L: search the user entry (service account)
    L-->>K: DN, attributes, groups
    K->>L: bind as the user with their password
    L-->>K: success or invalid credentials
    K-->>U: session, then tokens for the application

The second bind carries the user’s password as is. Over ldap:// without StartTLS, anyone on the path between Keycloak and the directory reads it in clear text. This is the whole reason for the rest of this article.

The Keycloak add-on is a standard Keycloak: the LDAP provider is configured exactly as below, from the admin console. Only two things are specific to the platform, the location of the CA certificate (deploying the truststore) and the network path to an on-premise directory (Network Groups).

LDAP and Active Directory: not the same thing

The two words are often used interchangeably. They should not be, because Keycloak does not configure them the same way.

LDAP (Lightweight Directory Access Protocol, RFC 4511) is a protocol: a way to search, read and modify entries in a tree-shaped directory. OpenLDAP, 389 Directory Server, FreeIPA or Oracle Unified Directory are directory servers that speak it, with the standard schemas (inetOrgPerson, groupOfNames…).

Active Directory is a Microsoft product: the directory service of a Windows domain. It speaks LDAP, but it is also a Kerberos realm, a DNS server and the backbone of group policies. Its schema and behaviour are its own:

OpenLDAP and standard directoriesActive Directory
User object classinetOrgPersonuser (with person, organizationalPerson)
Login attributeuidsAMAccountName or userPrincipalName
Unique identifierentryUUIDobjectGUID (binary)
Password attributeuserPassword, hashed by the serverunicodePwd, write-only, requires an encrypted connection
Disabled account, expired passworddepends on the server (ppolicy overlay…)userAccountControl, pwdLastSet
Group membershipmember on the group, optionally memberOfmember and memberOf, nested groups, primary group stored apart
Page size of a searchserver setting1000 entries by default (MaxPageSize)
LDAPS certificatewhatever you installone per domain controller, often issued by AD CS

In Keycloak, the Vendor field of the LDAP provider applies a preset for each family: picking Active Directory fills objectGUID as UUID attribute, the user object classes, and adds the MSAD account controls mapper that reads userAccountControl and pwdLastSet. Choose it first, before filling in the other fields.

Active Directory also brings Kerberos, which Keycloak can use for desktop single sign-on (SPNEGO): a user signed in to a domain workstation reaches Keycloak without typing a password. It is configured in the same LDAP provider (Kerberos integration), but it is a topic of its own, outside the scope of this article.

LDAPS or StartTLS?

Two ways to encrypt an LDAP connection:

  • LDAPS (ldaps://, port 636): TLS from the first byte, like HTTPS. Nothing ever travels in clear.
  • StartTLS (ldap://, port 389, Enable StartTLS on): the connection opens in clear, then switches to TLS before the bind.

Both work with Keycloak, and both rely on the same truststore. We recommend LDAPS: there is no clear-text phase to get wrong, and a firewall rule on port 636 is enough to know that nothing unencrypted goes through. With StartTLS, encryption depends on a checkbox: in our test directory, a provider with the box unticked binds over plain 389 without complaint, unless the directory itself refuses clear-text binds.

On the directory side, refuse clear-text binds anyway. Recent Windows Server versions push in that direction with LDAP signing and channel binding: a simple bind over plain 389 is refused when signing is required.


Step 1: trust the directory certificate

Get the CA certificate

The directory certificate is almost always issued by an internal CA: your PKI, or AD CS for Active Directory. Keycloak must trust that CA, and only that CA, not the server certificate itself (which changes at every renewal).

Ask your PKI team for the root certificate in PEM format, or look at the chain the server presents:

openssl s_client -connect ldap.corp.example:636 -showcerts </dev/null

The last certificate of the chain is signed by the root. Check the subject alternative names of the server certificate while you are at it: the host name you will type in Keycloak’s connection URL must be one of them.

openssl s_client -connect ldap.corp.example:636 </dev/null 2>/dev/null \
  | openssl x509 -noout -subject -issuer -ext subjectAltName
subject=CN=ldap.corp.example
issuer=CN=Corp Example Root CA
X509v3 Subject Alternative Name:
    DNS:ldap.corp.example

Deploy it with the Keycloak truststore

In current Keycloak versions, the truststore is configured with a single option, truststore-paths, or the KC_TRUSTSTORE_PATHS environment variable. It takes a list of files or directories: certificates in .pem, .crt or .cer files (PEM, and in our tests DER as well), or PKCS12 without password (.p12, .pfx, .pkcs12). A directory is scanned recursively, and files with other extensions are ignored.

bin/kc.sh start --truststore-paths=/opt/keycloak/truststores/corp-root-ca.pem
# or
export KC_TRUSTSTORE_PATHS=/opt/keycloak/truststores

Even simpler: Keycloak reads conf/truststores/ on its own. A certificate copied there is trusted without any option.

Four things worth knowing:

  • it is a runtime option: no kc.sh build needed, a restart is enough;
  • the Java default CAs stay trusted: the certificates you add come on top of the JDK cacerts;
  • a broken file stops Keycloak: a truststore file it cannot read, a truncated PEM or a private key saved as .pem, and Keycloak refuses to start with Failed to initialize truststore, could not merge. A password-protected PKCS12, on the other hand, is silently skipped;
  • Keycloak logs what it loaded at startup, the first thing to check when a connection fails:
INFO  [org.keycloak.truststore.TruststoreBuilder] (main) Found the following truststore files
in the truststore paths [/opt/keycloak/truststores/corp-root-ca.pem]

With Docker, mount the file and set the variable:

services:
  keycloak:
    image: quay.io/keycloak/keycloak:26.8.2
    environment:
      KC_TRUSTSTORE_PATHS: /opt/keycloak/truststores
    volumes:
      - ./truststores:/opt/keycloak/truststores:ro

On Kubernetes, the CA of the cluster and of its service accounts are added automatically (truststore-kubernetes-enabled, on by default). Your directory CA is not: mount it from a Secret or a ConfigMap and point KC_TRUSTSTORE_PATHS at it.

On Clever Cloud: the truststore goes in the FS Bucket

From version 26.8.2, the Keycloak add-on reads its truststore from the FS Bucket, next to your themes/ and providers/:

  1. upload corp-root-ca.pem to the truststores/ folder of the FS Bucket;
  2. restart the application. No rebuild, no environment variable.

At each start, the add-on checks every file of that folder with openssl before handing it to Keycloak. A file Keycloak could not read is left out and reported, instead of preventing the start: an upload gone wrong never takes your login page down. The application logs show the result:

Truststores: installed corp-root-ca.pem (1 certificate(s))
Truststores: 1 file(s) installed, 0 rejected

followed by Keycloak’s own TruststoreBuilder line. All instances read the same bucket. To renew the CA, replace the file and restart; a file removed from the folder is no longer trusted after the next restart.

Use Truststore SPI: Always or Never?

The LDAP provider has a Use Truststore SPI field, with two values in Keycloak 26: Always and Never. Leave it on Always.

You may notice that Never still connects. That is expected: the certificates given to truststore-paths also become the JVM’s default truststore, which Never falls back to. The field only matters if you configure the JVM truststore some other way, which you have no reason to do any more.

When it fails: the two errors you will meet

The CA is missing from the truststore:

javax.net.ssl.SSLHandshakeException: (certificate_unknown) PKIX path building failed:
sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

Check the startup log: no TruststoreBuilder line, or not the file you expected.

The host name is not in the certificate:

javax.net.ssl.SSLHandshakeException: (certificate_unknown) No subject alternative DNS name matching openldap found.

Here the CA is trusted, but the connection URL uses a name (openldap) that the certificate does not list. For LDAP, Keycloak always verifies the host name strictly: the tls-hostname-verifier option does not apply to LDAP connections, and there is no switch to turn the check off. Fix the URL, or have the certificate reissued with the right name. Connecting to an IP address fails the same way unless the IP is in the SAN.


Step 2: create the LDAP provider

In the admin console: User federation → Add LDAP providers. The settings that matter, for OpenLDAP and for Active Directory:

SettingOpenLDAPActive Directory
VendorOtherActive Directory
Connection URLldaps://ldap.corp.example:636ldaps://dc1.corp.example:636 ldaps://dc2.corp.example:636
Enable StartTLSOffOff
Use Truststore SPIAlwaysAlways
Bind typesimplesimple
Bind DNuid=svc-keycloak,ou=people,dc=corp,dc=exampleCN=svc-keycloak,OU=Service Accounts,DC=corp,DC=example
Users DNou=people,dc=corp,dc=exampleOU=Staff,DC=corp,DC=example
Username LDAP attributeuidsAMAccountName (the preset says cn)
RDN LDAP attributeuidcn
UUID LDAP attributeentryUUIDobjectGUID
User object classesinetOrgPerson, organizationalPersonperson, organizationalPerson, user
User LDAP filter(!(uid=svc-*))(!(userAccountControl:1.2.840.113556.1.4.803:=2)) to skip disabled accounts
Search scopeOne LevelSubtree
PaginationOnOn

A few choices deserve an explanation:

  • Several URLs, separated by spaces, give you failover: Keycloak tries the next one when a server does not answer. With Active Directory, list your domain controllers; each one must present a certificate with its own name. Pointing at the domain name (corp.example) also works, provided the controllers’ certificates carry that name too.
  • A dedicated service account, never the directory administrator. It needs read access to the users and groups, plus write access only if you choose the WRITABLE mode (and, on Active Directory, the Reset password permission on the users’ OU).
  • The user filter keeps out of Keycloak what has nothing to do there: service accounts, disabled accounts, a population that does not use your applications.
  • The username attribute on Active Directory: the preset proposes cn, which is the display name in most domains. Users sign in with sAMAccountName, so set it explicitly.

Then use the two buttons of the form: Test connection checks the network, TLS and certificate, Test authentication checks the bind with the service account. If both pass, save.

Nothing changes in this form on the managed add-on. The connection URL simply points at a directory reachable from Clever Cloud: a directory exposed in LDAPS on the Internet (filtered by IP), or, much better, an on-premise directory reached through a Network Group, described below.

Edit mode: who is allowed to write?

The Edit mode field decides what happens when a user, or an administrator, changes something in Keycloak: a password, an email, a first name.

Edit modePassword changed in KeycloakWhat we observed
READ_ONLYrefusedThe admin API rejects the reset, the directory is never written to
UNSYNCEDstored in Keycloak onlyThe new password works, the directory still has the old one, and Keycloak no longer accepts the directory password
WRITABLEwritten to the directoryThe new password works for Keycloak and for an LDAP bind

Our recommendations, from the projects we have run:

  • READ_ONLY when the directory is managed elsewhere, by the HR process or the Windows team. Password changes then happen where they always have: Ctrl+Alt+Del, the self-service portal, the helpdesk. It is the safest mode, and the one most security teams will accept for a first deployment.
  • WRITABLE when Keycloak becomes the front door, with the “forgot password” link and the account console. Keep in mind that Keycloak then writes to the directory with the service account’s rights: grant them narrowly.
  • UNSYNCED rarely, and knowingly. It is handy to let Keycloak hold data the directory cannot store, but a password changed in Keycloak silently takes precedence over the directory: the two drift apart, and the user ends up with two passwords depending on the application. We mostly use it in migrations, when Keycloak is about to take over from the directory.
A read-only directory does not prevent second factors: OTP and WebAuthn credentials are always stored in Keycloak’s own database, even for federated users. Our article on mandatory MFA without forcing personal phones was built for exactly that setup, passwords in Active Directory and second factors in Keycloak.

Active Directory: password changes and account states

Active Directory is where most surprises come from. Field notes:

  • Writing a password requires an encrypted connection. Active Directory only accepts changes to unicodePwd over LDAPS or StartTLS. In WRITABLE mode over plain 389, password changes fail, even when everything else works. One more reason for LDAPS.
  • The domain password policy applies. Complexity, minimum length, history: Active Directory enforces its own rules and refuses a password that breaks them. Align Keycloak’s password policy with the domain’s, so that users get a clear message on the form rather than a generic error. Some Keycloak policies (Not Recently Used, Expire Password, hashing settings) cannot work on a password Keycloak does not store: leave them to the domain.
  • “User must change password at next logon” (pwdLastSet=0) is read by the MSAD account controls mapper: Keycloak asks the user for a new password at login. Writing it back needs the WRITABLE mode; in READ_ONLY, these users cannot get past that step through Keycloak.
  • A disabled account (userAccountControl) is shown as disabled in Keycloak, and cannot sign in.
  • Locked accounts: Active Directory locks an account after too many failed binds, and Keycloak’s brute force detection counts failures on its side. Make sure Keycloak’s threshold is lower than the domain’s, otherwise a password-spraying attempt through your login page locks real accounts in the whole domain.

Synchronisation and performance

Import or not

With Import users on (the default), Keycloak keeps a local copy of each account: logins and lookups are fast, and the directory is only queried for the password check and the synchronisations. With import off, every lookup goes to the directory: no stale copy, but the directory becomes a hard dependency of every request, and the admin console lists nothing until you search.

Keep import on in nearly every case. Turn it off when the directory changes so often that a copy would always be out of date, and size the directory for the load.

Periodic synchronisation

Two independent schedules, in seconds:

  • Periodic full sync: reads every entry in scope. Once a day is plenty (86400).
  • Periodic changed users sync: reads only the entries modified since the last run, based on their modification timestamp. Every hour, or more often if your onboarding needs it.

On a Keycloak cluster, a scheduled sync runs on a single node, not on all of them.

What the synchronisation does not decide: whether a deleted account can sign in. In our tests, an account deleted from the directory was refused at the very next login, and its local copy removed as soon as Keycloak looked it up, before any synchronisation ran. A password changed in the directory works right away too, since the bind always goes to the directory.

Large directories

  • Turn pagination on, mandatory with Active Directory: without it, searches stop at the server’s page size (1000 entries by default on AD) and a full sync silently misses users.
  • Narrow the scope with the users DN and the user filter rather than importing the whole company to serve one department.
  • Batch size for sync (default 1000) sets how many users are imported per transaction.
  • The cache policy of the provider (DEFAULT, EVICT_DAILY, EVICT_WEEKLY, MAX_LIFESPAN, NO_CACHE) decides how long Keycloak keeps imported users in memory before reading them again.

The first full sync of a large directory can take a while: run it by hand, outside business hours, before enabling the periodic schedule.


Groups and roles from the directory

Users come with the provider; groups and roles need mappers, in the Mappers tab of the provider.

group-ldap-mapper imports directory groups as Keycloak groups:

SettingOpenLDAPActive Directory
LDAP Groups DNou=groups,dc=corp,dc=exampleOU=Groups,DC=corp,DC=example
Group object classesgroupOfNamesgroup
Membership LDAP attributemembermember
Membership attribute typeDNDN
User groups retrieve strategyLOAD_GROUPS_BY_MEMBER_ATTRIBUTELOAD_GROUPS_BY_MEMBER_ATTRIBUTE_RECURSIVELY or GET_GROUPS_FROM_USER_MEMBEROF_ATTRIBUTE
ModeREAD_ONLYREAD_ONLY

Field notes:

  • Nested groups on Active Directory: LOAD_GROUPS_BY_MEMBER_ATTRIBUTE_RECURSIVELY uses an AD-only matching rule (LDAP_MATCHING_RULE_IN_CHAIN) to resolve all the groups a user belongs to, directly or not, in a single query.
  • The primary group is not in memberOf. Domain Users is stored as primaryGroupID on the user, not as a membership: no mapper will give it to you. Do not build an authorisation rule on it.
  • Filter the groups: an Active Directory holds thousands of groups (distribution lists, file shares, GPO filtering). Use the mapper’s LDAP filter to import only those your applications use. Very large groups also slow down every login that loads them.
  • Groups, then roles. Rather than using role-ldap-mapper to turn directory groups into roles, we usually import groups with group-ldap-mapper and assign roles to those groups in Keycloak. The directory says who belongs where, Keycloak says what that grants in each application.
  • Attributes come through user-attribute-ldap-mapper: department, employee number, phone. Each one becomes a user attribute, ready for a token mapper.

An on-premise directory and Keycloak in the cloud

Most directories are not, and should not be, reachable from the Internet. Yet nothing prevents the identity provider from running in the cloud: Keycloak only needs a private, encrypted path to port 636 of the directory.

Network Groups build a private network between Clever Cloud resources with WireGuard tunnels, and accept external peers: a server of yours that joins the group with its own WireGuard key. Link the Java application of the Keycloak add-on to a Network Group, add the directory server as an external peer, and Keycloak reaches ldaps:// over the tunnel. Nothing is exposed on the Internet.
flowchart LR
    subgraph CC [Clever Cloud]
        KC[Keycloak add-on<br/>Java application]
    end
    subgraph NG [Network Group: WireGuard]
        direction LR
        T((WireGuard<br/>tunnel))
    end
    subgraph OP [On premise]
        LDAP[(LDAP / Active Directory<br/>external peer)]
    end
    KC ---|ldaps:// 636| T
    T --- LDAP
    Users([Users]) -->|HTTPS| KC

Two layers of encryption, each with its own job: WireGuard protects the network path and decides who can join it, LDAPS authenticates the directory to Keycloak and protects the passwords end to end, up to the directory itself.

Setting up the tunnel

With Clever Tools:

# Network Groups are behind a feature flag in Clever Tools
clever features enable ng

# Create the group and link the Java application of the Keycloak add-on (app_xxx)
clever ng create ldap-link --link app_xxx

# On the directory server: generate its WireGuard key pair
umask 077; wg genkey | tee wg-private.key | wg pubkey > wg-public.key

# Declare the directory server as an external peer, with its public key
clever ng create external ldap-onprem ldap-link "$(cat wg-public.key)"

# Get the WireGuard configuration of the peer, to install on the directory server
clever ng get-config ldap-onprem ldap-link

Clever Cloud only knows the public key: put the private key generated above in the [Interface] section, bring the tunnel up on the server (wg-quick, or your distribution’s network manager), then read the peer’s domain name and private IP with clever ng get ldap-link. Members are named <member-id>.m.<ng-id>.cc-ng.cloud.

The Network Groups are still flagged as a testing phase in the Clever Cloud documentation for add-ons and external peers: validate your setup on a staging realm before moving production logins onto it.

Which host name for the certificate?

Keycloak verifies the host name strictly, and the directory is now reached by a new name. Two clean options, pick the one that fits your constraints:

Option 1: add the Network Group name to the certificate. Have your internal CA reissue the directory certificate with <member-id>.m.<ng-id>.cc-ng.cloud in its subject alternative names, next to the internal name, and use that name in the connection URL. Nothing else to configure, and the name follows the peer. The price: the certificate is tied to this Network Group, and changes if you recreate it.

Option 2: keep the internal name. The certificate stays as it is (ldap.corp.example), and that name must resolve, from Keycloak, to the peer’s private IP. On a PaaS you cannot edit /etc/hosts, so the record has to come from DNS: an A record in a zone Keycloak can resolve, pointing to the private IP of the peer. It publishes a private address, which reveals little but is something to agree on with your security team, and it assumes the peer keeps the same IP.

The Java property -Djdk.net.hosts.file looks like a shortcut for option 2: a hosts file read by the JVM, which could sit in the FS Bucket. We tried it: the LDAP connection works, but the JVM then resolves every name from that file and nothing else. Keycloak could not even resolve its own host name, and the database host would be next. Do not use it.

Tested for real

We reproduced this setup on a local stack, with the CA certificate installed the way the Clever Cloud add-on does it (the add-on’s own script, run under Ubuntu 24.04 with OpenSSL 3, copying the FS Bucket certificates to conf/truststores/, no KC_TRUSTSTORE_PATHS):

  • Keycloak 26.8.2 (Java 21), start-dev;
  • OpenLDAP 2.4.57 (osixia/openldap:1.5.0), LDAPS on 636, certificate issued by a private CA for ldap.corp.example only;
  • a realm configured with kcadm.sh, and a test script driving the admin REST API and the token endpoint.
== Connection
PASS LDAPS connection with the CA in the truststore
PASS LDAPS bind of the service account
PASS LDAPS refused on a name missing from the certificate SAN
== Synchronisation
   {"ignored":false,"added":2,"updated":0,"removed":0,"failed":0,"status":"2 imported users, 0 updated users"}
PASS full sync imports 2 users (service account filtered out)
   {"ignored":false,"added":0,"updated":2,"removed":0,"failed":0,"status":"0 imported groups, 2 updated groups, 0 removed groups"}
PASS group sync
PASS jdupont is in both groups
PASS jdupont is federated (federationLink set)
== Login: the password is checked by the directory over LDAPS
PASS login jdupont with the LDAP password
PASS login refused with a wrong password
PASS a password changed in the directory works right away
== Edit mode READ_ONLY
PASS set READ_ONLY
PASS password reset from Keycloak refused
PASS directory password unchanged
== Edit mode UNSYNCED
PASS set UNSYNCED
PASS password reset from Keycloak accepted
PASS login with the Keycloak-local password
PASS directory password untouched
PASS directory password no longer accepted by Keycloak
== Edit mode WRITABLE
PASS set WRITABLE
PASS password reset from Keycloak accepted
PASS new password written to the directory (LDAP bind)
PASS login with the new password
== Account deleted from the directory
PASS login refused right away, before any sync
PASS local copy removed at first lookup

24 passed, 0 failed

Also checked by hand: the add-on’s certificate check against twelve files (PEM, bundles, DER, PKCS12 with and without password, a truncated PEM, a private key, an empty file…), each compared with what Keycloak does with the same file on its own; without the CA, both Use Truststore SPI values fail with the PKIX error; with truststore-paths set, Never connects too; a certificate in conf/truststores/ is picked up with no option at all, and on top of KC_TRUSTSTORE_PATHS when both are set; StartTLS on port 389; failover between two connection URLs; the JVM hosts file trap.

Not tested here: Active Directory itself, and the Network Group tunnel. The Active Directory notes come from our customer projects; validate them against your own domain policy.


FAQ

Does Keycloak store LDAP passwords?

No. With an LDAP provider, Keycloak checks each password with an LDAP bind against the directory and stores nothing, except in UNSYNCED mode once a user changes their password in Keycloak.

How do I add an LDAP CA certificate to Keycloak?

Give the PEM file, or the directory that holds it, to the truststore-paths option (KC_TRUSTSTORE_PATHS), or copy it to conf/truststores/, then restart Keycloak. No rebuild is needed, and the startup log lists each certificate found.

Why does Keycloak say “No subject alternative DNS name matching”?

The host name of the connection URL is not in the directory certificate. Keycloak always verifies host names on LDAP connections, and tls-hostname-verifier does not change that: use a name listed in the certificate, or have it reissued.

Can Keycloak in the cloud use an on-premise Active Directory?

Yes, as long as it reaches port 636 of a domain controller through a private path. On Clever Cloud, a Network Group links the Keycloak add-on to the on-premise server with a WireGuard tunnel, without exposing the directory to the Internet.

Which edit mode should I choose?

READ_ONLY if the directory is managed elsewhere and passwords change there, WRITABLE if Keycloak’s password reset and account console must update the directory. Avoid UNSYNCED outside migrations: passwords drift between Keycloak and the directory.


Conclusion

Federating a directory is one of the first things asked of Keycloak, and one of the quickest to get working. Getting it right takes a little more: an encrypted connection with a certificate Keycloak really verifies, an edit mode chosen on purpose, a scope and a synchronisation sized for the directory, and groups that carry meaning.

The truststore part is now a single option, on any platform. On Clever Cloud, it is one file in the FS Bucket and a restart, and Network Groups let the directory stay where it is, on your premises, while Keycloak runs as a managed service.

If you are planning a migration from a legacy directory, the reverse is possible too: our LDAP Bind Proxy lets legacy LDAP applications authenticate against Keycloak. And for a review of your federation setup, or the architecture around it, that is what we do: Keycloak architecture and deployment and Keycloak audit.