Filtering LDAP
Description
Filtering LDAP - Authenticated Users
The need
A means of more finely discriminating LDAP-authenticated users for Wiki membership.
- Lift some limitations of the existing
LDAPAuthServiceImplclass:- Users from multiple LDAP - containers should be able to login
- Not all users from an LDAP - container should be allowed to login Initially, a desire has been expressed by XWiki administrators to modify the behavior of the LDAPAuthServiceImpl:
- to refuse entry to users whose DN does not contain an Organization attribute matching a particular pattern or list of values
- to use a different attribute than CommonName from the DN as the Wiki name.
Implementation ideas
To implement the first, it was proposed that a subclass of LDAPAuthServiceImpl would override only the authenticate method, leaving it unchanged except for the addition of a further qualification to the else block of the line that checks that the String returned from getLDAP_DN() is neither null nor empty before testing the password. The returned DN could be checked against a regular expression or a list of values.
Current plan is to rewrite the LDAPAuthServiceImpl module with the following behavior:
- check Superadmin
- check if ldap authentication is off => authenticate against db
- bind to LDAP => if failed try db
- if group param, verify group membership (& get DN)
- if no group locate dn_ldap attribute on user
- if no dn search for user
- compare pwd
- if flag check if user exists => create user
- if flag update user attributes
- if flag update Xwiki groupmembership
- on Error try local DB login
Additionally, the LDAP groups should be cached. Also, I intend to load LDAP groups recursivly handling groups in groups.
Additional features include SSL access to the eDirectory.
Code for this proposed functionality is already submitted in JIRA-1079