use of org.opensaml.saml.metadata.resolver.filter.MetadataFilterChain in project cas by apereo.
the class SamlMetadataUIConfiguration method configureAdapter.
private MetadataResolverAdapter configureAdapter(final AbstractMetadataResolverAdapter adapter) {
final Map<Resource, MetadataFilterChain> resources = new HashMap<>();
final MetadataFilterChain chain = new MetadataFilterChain();
casProperties.getSamlMetadataUi().getResources().forEach(Unchecked.consumer(r -> configureResource(resources, chain, r)));
adapter.setRequireValidMetadata(casProperties.getSamlMetadataUi().isRequireValidMetadata());
adapter.setMetadataResources(resources);
adapter.setConfigBean(openSamlConfigBean);
return adapter;
}
use of org.opensaml.saml.metadata.resolver.filter.MetadataFilterChain in project cas by apereo.
the class StaticMetadataResolverAdapterTests method verifyOperation.
@Test
public void verifyOperation() {
val resources = (Map) Map.of(new ClassPathResource("metadata.xml"), new MetadataFilterChain());
val adapter = new StaticMetadataResolverAdapter(resources);
adapter.setConfigBean(configBean);
adapter.setMetadataResources(resources);
adapter.buildMetadataResolverAggregate();
assertNotNull(adapter.getEntityDescriptorForEntityId("https://carmenwiki.osu.edu/shibboleth"));
}
use of org.opensaml.saml.metadata.resolver.filter.MetadataFilterChain in project cas by apereo.
the class BaseSamlRegisteredServiceMetadataResolver method addMetadataFiltersToMetadataResolver.
/**
* Add metadata filters to metadata resolver.
*
* @param metadataProvider the metadata provider
* @param metadataFilterList the metadata filter list
*/
protected void addMetadataFiltersToMetadataResolver(final AbstractMetadataResolver metadataProvider, final List<MetadataFilter> metadataFilterList) {
val metadataFilterChain = new MetadataFilterChain();
metadataFilterChain.setFilters(metadataFilterList);
LOGGER.debug("Metadata filter chain initialized with [{}] filters", metadataFilterList.size());
metadataProvider.setMetadataFilter(metadataFilterChain);
}
use of org.opensaml.saml.metadata.resolver.filter.MetadataFilterChain in project cas by apereo.
the class ChainingMetadataResolverCacheLoader method buildMetadataFilters.
/**
* Build metadata filters.
*
* @param service the service
* @param metadataProvider the metadata provider
* @throws Exception the exception
*/
protected void buildMetadataFilters(final SamlRegisteredService service, final AbstractMetadataResolver metadataProvider) throws Exception {
final List<MetadataFilter> metadataFilterList = new ArrayList<>();
buildRequiredValidUntilFilterIfNeeded(service, metadataFilterList);
buildSignatureValidationFilterIfNeeded(service, metadataFilterList);
buildEntityRoleFilterIfNeeded(service, metadataFilterList);
buildPredicateFilterIfNeeded(service, metadataFilterList);
if (!metadataFilterList.isEmpty()) {
final MetadataFilterChain metadataFilterChain = new MetadataFilterChain();
metadataFilterChain.setFilters(metadataFilterList);
LOGGER.debug("Metadata filter chain initialized with [{}] filters", metadataFilterList.size());
metadataProvider.setMetadataFilter(metadataFilterChain);
}
}
use of org.opensaml.saml.metadata.resolver.filter.MetadataFilterChain in project cas by apereo.
the class DynamicMetadataResolverAdapterTests method verifyOperation.
@Test
public void verifyOperation() throws Exception {
val resource = new UrlResource(new URI("http://localhost:6622/entities/"));
val adapter = new DynamicMetadataResolverAdapter(Map.of(resource, new MetadataFilterChain()));
adapter.setConfigBean(configBean);
val entity = IOUtils.toString(new ClassPathResource("metadata.xml").getInputStream(), StandardCharsets.UTF_8);
try (val webServer = new MockWebServer(6622, new ByteArrayResource(entity.getBytes(StandardCharsets.UTF_8), "Output"), HttpStatus.OK)) {
webServer.start();
assertNotNull(adapter.getEntityDescriptorForEntityId("https://carmenwiki.osu.edu/shibboleth"));
}
}
Aggregations