Class LdapStringSanitizer


  • public class LdapStringSanitizer
    extends Object
    A sanitization utility which creates safe ldap search strings.
    Since:
    1.4.0
    Author:
    Steve Springett
    • Method Detail

      • sanitize

        public static String sanitize​(String input)
        Escapes any special chars (RFC 4515) from a string representing a search filter assertion value. This method should only be applied to LDAP filter search inputs (or other filter inputs) and not for full LDAP validation. For example:
         (&(objectClass=groupOfUniqueNames)(uniqueMember=INPUT))
        
        In this case, the INPUT would need to be sanitized via this method.
        Parameters:
        input - The input string.
        Returns:
        A assertion value string ready for insertion into a search filter string.
        Since:
        1.4.0