Search in sources :

Example 1 with PredicateFilter

use of org.opensaml.saml.metadata.resolver.filter.impl.PredicateFilter in project cas by apereo.

the class ChainingMetadataResolverCacheLoader method buildPredicateFilterIfNeeded.

private void buildPredicateFilterIfNeeded(final SamlRegisteredService service, final List<MetadataFilter> metadataFilterList) {
    if (StringUtils.isNotBlank(service.getMetadataCriteriaDirection()) && StringUtils.isNotBlank(service.getMetadataCriteriaPattern()) && RegexUtils.isValidRegex(service.getMetadataCriteriaPattern())) {
        final PredicateFilter.Direction dir = PredicateFilter.Direction.valueOf(service.getMetadataCriteriaDirection());
        LOGGER.debug("Metadata predicate filter configuring with direction [{}] and pattern [{}]", service.getMetadataCriteriaDirection(), service.getMetadataCriteriaPattern());
        final PredicateFilter filter = new PredicateFilter(dir, entityDescriptor -> StringUtils.isNotBlank(entityDescriptor.getEntityID()) && entityDescriptor.getEntityID().matches(service.getMetadataCriteriaPattern()));
        metadataFilterList.add(filter);
        LOGGER.debug("Added metadata predicate filter with direction [{}] and pattern [{}]", service.getMetadataCriteriaDirection(), service.getMetadataCriteriaPattern());
    }
}
Also used : PredicateFilter(org.opensaml.saml.metadata.resolver.filter.impl.PredicateFilter)

Aggregations

PredicateFilter (org.opensaml.saml.metadata.resolver.filter.impl.PredicateFilter)1