public class LdapGroupManager
extends java.lang.Object
Constructor and Description |
---|
LdapGroupManager(LdapConfig config,
org.apache.kafka.common.utils.Time time) |
LdapGroupManager(LdapConfig config,
org.apache.kafka.common.utils.Time time,
ExternalStoreListener<UserKey,UserValue> listener) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
boolean |
failed() |
java.util.Set<java.lang.String> |
groups(java.lang.String userPrincipal) |
protected java.util.Set<java.lang.String> |
searchAndProcessResults() |
protected java.util.Set<java.lang.String> |
searchAndProcessResults(boolean removeDeletedEntries) |
void |
start()
Starts the LDAP group manager and schedules either periodic or persistent search.
|
public LdapGroupManager(LdapConfig config, org.apache.kafka.common.utils.Time time)
public LdapGroupManager(LdapConfig config, org.apache.kafka.common.utils.Time time, ExternalStoreListener<UserKey,UserValue> listener)
public void start()
For periodic search, a new search is scheduled every refresh interval to refresh the cache from LDAP.
Even when persistent search is enabled, a non-persistent search is used for initialization because we cannot detect when all the existing entries have been processed by a persistent search since `enumeration.next()` just blocks waiting for changes. Persistent search is performed using changesOnly=false. So all entries are read a second time when the persistent search is initiated. This is to avoid the timing window if entries are updated in between the first non-persistent search and the persistent search request. If the overhead of a second read during `start()` turns out to be an issue, we will need to initiate the async persistent search with `changesOnly=true` on the scheduler thread and invoke the synchrononous non-persistent search on the thread invoking `start()` after that. Note that we would need to make processing of search results thread-safe. We would also need to re-populate the cache using non-persistent search on connection failures in the same way.
public void close()
public java.util.Set<java.lang.String> groups(java.lang.String userPrincipal)
public boolean failed()
protected java.util.Set<java.lang.String> searchAndProcessResults() throws javax.naming.NamingException, java.io.IOException
javax.naming.NamingException
java.io.IOException
protected java.util.Set<java.lang.String> searchAndProcessResults(boolean removeDeletedEntries) throws javax.naming.NamingException, java.io.IOException
javax.naming.NamingException
java.io.IOException