use of org.zaproxy.zap.extension.ascan.filters.FilterCriteria in project zaproxy by zaproxy.
the class AbstractGenericScanFilter method isFiltered.
protected FilterResult isFiltered(Collection<V> values) {
Objects.requireNonNull(values);
if (filterData.isEmpty()) {
return FilterResult.NOT_FILTERED;
}
FilterCriteria filterCriteria = this.getFilterCriteria();
switch(filterCriteria) {
case INCLUDE:
if (values.stream().anyMatch(value -> matcher.test(filterData, value))) {
return FilterResult.NOT_FILTERED;
}
return new FilterResult(Constant.messages.getString(INCLUDE_FILTER_CRITERIA_MESSAGE_KEY, this.getFilterType(), filterData));
case EXCLUDE:
for (V value : values) {
if (matcher.test(filterData, value)) {
return new FilterResult(Constant.messages.getString(EXCLUDE_FILTER_CRITERIA_MESSAGE_KEY, this.getFilterType(), "[" + value + "]"));
}
}
return FilterResult.NOT_FILTERED;
default:
return FilterResult.NOT_FILTERED;
}
}
Aggregations