Description
When thinking about how to make LDAP searches done by the authorization plugins more efficient (also see #2283), I discovered that LdapUserPlugin
can benefit from using the username as base.
Specifically, if the UserPlugin
fills the username
of a user with DN that matches its node in the LDAP structure, it is not necessary to use the filter at all - certainly not filling the common name there as LdapUserPlugin#getFilter()
does.
I.e. instead of passing null
as a first argument to lookupLdapContent()
in LdapUserPlugin#fillSession()
, it will pass user
(which will then be used as a base) and the filter can be augmented based on that (to only contain the this.objectClass
).
This can be made a tunable of UserLdapPlugin
- there are still cases when the search base cannot be based on User
.