Package org.nuxeo.ecm.directory.ldap
Class LDAPFilterMatcher
- java.lang.Object
-
- org.nuxeo.ecm.directory.ldap.LDAPFilterMatcher
-
public class LDAPFilterMatcher extends Object
Helper class to parse and evaluate if a LDAP filter expression matches a fetched LDAP entry.This is done by recursively evaluating the abstract syntax tree of the expression as parsed by an apache directory shared method.
- Author:
- Olivier Grisel
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected static boolean
isCaseSensitiveMatch(Attribute attribute)
protected static boolean
isCaseSensitiveSubstringMatch(Attribute attribute)
boolean
match(Attributes attributes, String filter)
Check whether a raw string filter expression matches on the given LDAP entry.protected static boolean
simpleMatch(Attributes attributes, org.apache.directory.shared.ldap.filter.SimpleNode simpleElement)
Handle simple equality test on any non-null value (eg:(attr2=value2)
).protected boolean
substringMatch(Attributes attributes, org.apache.directory.shared.ldap.filter.SubstringNode substringElement)
Implement the substring match on any non-null value of a string attribute (eg:(attr3=val*)
).
-
-
-
Method Detail
-
match
public boolean match(Attributes attributes, String filter)
Check whether a raw string filter expression matches on the given LDAP entry.- Parameters:
attributes
- the ldap entry to matchfilter
- a raw string filter expression (eg.(!(&(attr1=*)(attr2=value2)(attr3=val*)))
)- Returns:
- true if the ldap entry matches the filter
-
simpleMatch
protected static boolean simpleMatch(Attributes attributes, org.apache.directory.shared.ldap.filter.SimpleNode simpleElement)
Handle simple equality test on any non-null value (eg:(attr2=value2)
).- Returns:
- true if the equality holds
-
isCaseSensitiveMatch
protected static boolean isCaseSensitiveMatch(Attribute attribute)
-
isCaseSensitiveSubstringMatch
protected static boolean isCaseSensitiveSubstringMatch(Attribute attribute)
-
substringMatch
protected boolean substringMatch(Attributes attributes, org.apache.directory.shared.ldap.filter.SubstringNode substringElement)
Implement the substring match on any non-null value of a string attribute (eg:(attr3=val*)
).- Returns:
- the result of the regex evaluation
-
-