/** * Creates a new assertion request control with the provided filter. It will * be marked as critical. * * @param filter The string representation of the filter for this assertion * control. It must not be {@code null}. * * @throws LDAPException If the provided filter string cannot be decoded as * a search filter. */ public AssertionRequestControl(final String filter) throws LDAPException { this(Filter.create(filter), true); }
if (!config.getSearchFilter().isEmpty()) { filter = Filter.createANDFilter( Filter.create(config.getSearchFilter()), Filter.createEqualityFilter(config.getLoginAttribute(), userName) );
/** * Creates a new assertion request control with the provided filter. It will * be marked as critical. * * @param filter The string representation of the filter for this * assertion control. It must not be {@code null}. * @param isCritical Indicates whether this control should be marked * critical. * * @throws LDAPException If the provided filter string cannot be decoded as * a search filter. */ public AssertionRequestControl(final String filter, final boolean isCritical) throws LDAPException { this(Filter.create(filter), isCritical); }
/** * Creates a new search request with the provided information. Search result * entries and references will be collected internally and included in the * {@code SearchResult} object returned when search processing is completed. * * @param baseDN The base DN for the search request. It must not be * {@code null}. * @param scope The scope that specifies the range of entries that * should be examined for the search. * @param filter The string representation of the filter to use to * identify matching entries. It must not be * {@code null}. * @param attributes The set of attributes that should be returned in * matching entries. It may be {@code null} or empty if * the default attribute set (all user attributes) is to * be requested. * * @throws LDAPException If the provided filter string cannot be parsed as * an LDAP filter. */ public SearchRequest(final String baseDN, final SearchScope scope, final String filter, final String... attributes) throws LDAPException { this(null, null, baseDN, scope, DereferencePolicy.NEVER, 0, 0, false, Filter.create(filter), attributes); }
/** * Creates a new search request with the provided information. Search result * entries and references will be collected internally and included in the * {@code SearchResult} object returned when search processing is completed. * * @param baseDN The base DN for the search request. It must not be * {@code null}. * @param scope The scope that specifies the range of entries that * should be examined for the search. * @param filter The string representation of the filter to use to * identify matching entries. It must not be * {@code null}. * @param attributes The set of attributes that should be returned in * matching entries. It may be {@code null} or empty if * the default attribute set (all user attributes) is to * be requested. * * @throws LDAPException If the provided filter string cannot be parsed as * an LDAP filter. */ public SearchRequest(final String baseDN, final SearchScope scope, final String filter, final String... attributes) throws LDAPException { this(null, null, baseDN, scope, DereferencePolicy.NEVER, 0, 0, false, Filter.create(filter), attributes); }
Filter.create(searchFilterComplete);
/** * Creates a new search filter from the provided string representation. * * @param filterString The string representation of the filter to create. * It must not be {@code null}. * * @return The search filter decoded from the provided filter string. * * @throws LDAPException If the provided string cannot be decoded as a valid * LDAP search filter. */ public static Filter create(final String filterString) throws LDAPException { ensureNotNull(filterString); return create(filterString, 0, (filterString.length() - 1), 0); }
/** * Ensures that a search operation is processed with the given filter. This * will either process the search operation immediately in the current thread * (if a single manage-account search thread is configured), or will enqueue * the filter to be processed by another thread. * * @param filter The string representation of the filter to use for the * search request to process. * * @throws LDAPException If the provided string cannot be parsed as a valid * search filter. */ void processFilter(final String filter) throws LDAPException { processFilter(Filter.create(filter)); }
/** * Creates a new search filter from the provided string representation. * * @param filterString The string representation of the filter to create. * It must not be {@code null}. * * @return The search filter decoded from the provided filter string. * * @throws LDAPException If the provided string cannot be decoded as a valid * LDAP search filter. */ public static Filter create(final String filterString) throws LDAPException { ensureNotNull(filterString); return create(filterString, 0, (filterString.length() - 1), 0); }
/** * Specifies the filter that should be used to identify matching entries. * * @param filter The string representation for the filter that should be * used to identify matching entries. It must not be * {@code null}. * * @throws LDAPException If the provided filter string cannot be parsed as a * search filter. */ public void setFilter(final String filter) throws LDAPException { ensureNotNull(filter); this.filter = Filter.create(filter); }
/** * Specifies the filter that should be used to identify matching entries. * * @param filter The string representation for the filter that should be * used to identify matching entries. It must not be * {@code null}. * * @throws LDAPException If the provided filter string cannot be parsed as a * search filter. */ public void setFilter(final String filter) throws LDAPException { ensureNotNull(filter); this.filter = Filter.create(filter); }
/** * Retrieves the parsed report filters that should be used to identify which * entries should be examined during the course of the audit. * * @return The parsed report filters that should be used to identify which * entries should be examined during the course of the audit, or an * empty list if all entries should be examined. * * @throws LDAPException If any of the filter strings cannot be parsed as a * valid filter. */ public List<Filter> getReportFilters() throws LDAPException { if (reportFilters.isEmpty()) { return Collections.emptyList(); } final ArrayList<Filter> filterList = new ArrayList<Filter>(reportFilters.size()); for (final String filter : reportFilters) { filterList.add(Filter.create(filter)); } return Collections.unmodifiableList(filterList); }
/** * Parses the provided string as a search filter. * * @param s The string to be parsed. * * @return The parsed filter. * * @throws LDAPSearchException If the provided string could not be parsed as * a valid search filter. */ private static Filter parseFilter(final String s) throws LDAPSearchException { try { return Filter.create(s); } catch (final LDAPException le) { throw new LDAPSearchException(le); } }
Filter.create(filter);
/** * Retrieves a parsed representation of the filter for the search request. * * @return A parsed representation of the filter for the search request, or * {@code null} if it is not included in the log message or the * filter string cannot be parsed as a filter. */ public final Filter getParsedFilter() { try { if (filter == null) { return null; } else { return Filter.create(filter); } } catch (Exception e) { debugException(e); return null; } }
public List<String> getParamsFromSearchString(String searchString) { if (StringUtils.isBlank(searchString)) { return new ArrayList<String>(); } if (searchString.startsWith(PLUS_SIGN)) { return getParametersForClassicSearchFormat((searchString)); } else if (searchString.startsWith(OPEN_PARENS)) { searchString = textToLDapSearch(searchString); Filter filter; try { filter = Filter.create(searchString); } catch (LDAPException ex) { throw new IllegalArgumentException("Invalid LDAP Search Parameter"); } return getParametersFromLdapFilter(filter); } else { throw new IllegalArgumentException("Invalid Search Parameter: Search must begin with a '+' or a '(' character"); } }
public String getSqlFromSearchString(String searchString) { if (StringUtils.isBlank(searchString)) { return null; } if (searchString.startsWith(PLUS_SIGN)) { return getSqlForClassicSearchFormat(searchString); } else if (searchString.startsWith(OPEN_PARENS)) { searchString = textToLDapSearch(searchString); Filter filter; try { filter = Filter.create(searchString); } catch (LDAPException ex) { throw new IllegalArgumentException("Invalid LDAP Search Parameter"); } return getSqlFromLdapFilter(filter); } else { throw new IllegalArgumentException("Invalid Search Parameter: Search must begin with a '+' or a '(' character"); } }
/** * Parses the provided string as a {@code Filter} object. * * @param filterString The string to parse as a {@code Filter}. * * @return The parsed {@code Filter}. * * @throws LDAPSearchException If the provided string does not represent a * valid search filter. */ private static Filter parseFilter(final String filterString) throws LDAPSearchException { try { return Filter.create(filterString); } catch (final LDAPException le) { debugException(le); throw new LDAPSearchException(le); } }
/** * Parses the provided string as a {@code Filter} object. * * @param filterString The string to parse as a {@code Filter}. * * @return The parsed {@code Filter}. * * @throws LDAPSearchException If the provided string does not represent a * valid search filter. */ private static Filter parseFilter(final String filterString) throws LDAPSearchException { try { return Filter.create(filterString); } catch (final LDAPException le) { debugException(le); throw new LDAPSearchException(le); } }
filter = Filter.create(searchFilter.replaceAll("%u", sanitizedAttribute));