Skip to content

Commit

Permalink
Merge pull request #32 from GluuFederation/issue_2444_orm
Browse files Browse the repository at this point in the history
fix(orm): exclude lowercase fitler in ldap filter converter
  • Loading branch information
yuremm authored Nov 22, 2024
2 parents 5d75551 + e663783 commit ecd2828
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,38 @@ public Filter excludeFilter(Filter genericFilter, Filter... excludeFilters) {
return genericFilter;
}

public Filter excludeLowerFilter(Filter genericFilter) {
if (genericFilter == null) {
return null;
}

FilterType type = genericFilter.getType();
if (FilterType.RAW == type) {
return genericFilter;
}

Filter[] filters = genericFilter.getFilters();
if (filters != null) {
List<Filter> resultFilters = new LinkedList<>();
for (Filter filter : filters) {
if (filter.getType() == FilterType.LOWERCASE) {
genericFilter.setFilters(null);
genericFilter.setAttributeName(filter.getAttributeName());
genericFilter.setAssertionValue(filter.getAssertionValue());

}
return genericFilter;
}
if (resultFilters.size() == 0) {
return null;
}

Filter resultFilter = new Filter(type, resultFilters.toArray(new Filter[0]));
resultFilter.setAssertionValue(genericFilter.getAssertionValue());

return resultFilter;
}

return genericFilter;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -800,7 +800,7 @@ private String[] convertValuesToStringValues(final Object... attributeValues) {
}

private com.unboundid.ldap.sdk.Filter toLdapFilter(Filter genericFilter) throws SearchException {
return LDAP_FILTER_CONVERTER.convertToLdapFilter(genericFilter);
return LDAP_FILTER_CONVERTER.convertToLdapFilter(filterProcessor.excludeLowerFilter(genericFilter));
}

private com.unboundid.ldap.sdk.SearchScope toLdapSearchScope(SearchScope scope) throws SearchScopeException {
Expand Down

0 comments on commit ecd2828

Please sign in to comment.