Details
Description
The current code - org.apache.karaf.jaas.modules.ldap.LDAPLoginModule - forms the userFilter and roleFilter:
logger.debug("Looking for the user in LDAP with ");
logger.debug(" base DN: " + userBaseDN);
userFilter = userFilter.replaceAll("%u", user);
logger.debug("Looking for the user roles in LDAP with ");
logger.debug(" base DN: " + roleBaseDN);
roleFilter = roleFilter.replaceAll("%u", user);
roleFilter = roleFilter.replaceAll("%dn", userDN);
the "replaceAll" method is a regular expression replacement that interprets special characters. LDAP user names and DN can contain special characters and we do not want to process them. The filters should be formed as "quotes" - uninterpreted strings.