Keycloak 26.7.4: after a user was deleted in LDAP, the full sync reported "0 imported users, 2 updated users", the users count stayed 3, and the next admin search removed it with no admin event.
When It Runs — Run Report #RR14 · Testing what infrastructure actually does.
Provider · Component: Keycloak · LDAP user federation with Import users on — what happens in Keycloak's local database to a user who is deleted in LDAP: through a full and a changed-users sync, and when the user is next looked up, with "Remove invalid users during searches" at its default
Versions tested: measured — Keycloak 26.7.4 (the latest release as of 2026-09-28; 26.7.5, 26.8.0, 26.8.1 and 26.8.2, released on 2026-09-30, 2026-10-01, 2026-10-13 and 2026-11-05, were not measured), a single version, against one LDAP server, 389 Directory Server 3.1 (the project's container image, digest-pinned). source-read — the LDAP provider (LDAPStorageProviderFactory.java,LDAPStorageProvider.java),SynchronizationResult.java,UserStorageManager.java,UserStorageProviderModel.javaand the admin console's LDAP pages at the same tag. The reports quoted below are from Keycloak 23.0.4 and 26.0.5 — not measured.
Config profile: Keycloak 26.7.4 from the official image (digest-pinned) in development mode and 389 Directory Server 3.1, in containers on one Docker network on a dedicated test VM; two realms that differ in one setting — "Remove invalid users during searches" left at its default (on) inrr14and switched off inrr14-keep; in each, an LDAP provider (vendor Red Hat Directory Server, Import users on, edit modeREAD_ONLY, periodic syncs off, syncs run by hand), the same three test users, admin events and user events saved, and a realm role held only in Keycloak; the log categoryorg.keycloak.storage.UserStorageManagerat DEBUG and everything else at INFO.
Verified on: 2026-11-14 (desk sources re-checked; Keycloak 26.8.2 was the latest release) · lab measured 2026-09-28 on Keycloak 26.7.4.
Affects: Keycloak 26.7.4 realms with LDAP federation, Import users on and "Remove invalid users during searches" at its default: a user deleted in LDAP stayed in Keycloak after a full and a changed-users sync, and was removed when next looked up, together with the realm role mapping it held only in Keycloak, with no admin event and no log line at the INFO level; with the option off, the user stayed, disabled.
TL;DR: On Keycloak 26.7.4 with LDAP federation, a user deleted in LDAP stayed in Keycloak through a full and a changed-users sync — both sync results counted no removal — and was removed only when an administrator next looked it up, with no admin event and no log line at the INFO level; with "Remove invalid users during searches" off, the user stayed, disabled.
Full report: https://whenitruns.substack.com/p/when-keycloaks-ldap-sync-runs-past
Reproduction repo: https://github.com/whenitruns/when-keycloaks-ldap-sync-runs-past-a-user-deleted-in-the-directory