use of org.opensaml.saml.metadata.resolver.impl.DOMMetadataResolver in project cas by apereo.
the class AbstractMetadataResolverAdapter method buildSingleMetadataResolver.
/**
* Build single metadata resolver.
*
* @param metadataFilterChain the metadata filters chained together
* @param resource the resource
* @param document the xml document to parse
* @return list of resolved metadata from resources.
* @throws IOException the iO exception
*/
private List<MetadataResolver> buildSingleMetadataResolver(final MetadataFilter metadataFilterChain, final Resource resource, final Document document) throws IOException {
try {
final Element metadataRoot = document.getDocumentElement();
final DOMMetadataResolver metadataProvider = new DOMMetadataResolver(metadataRoot);
metadataProvider.setParserPool(this.configBean.getParserPool());
metadataProvider.setFailFastInitialization(true);
metadataProvider.setRequireValidMetadata(this.requireValidMetadata);
metadataProvider.setId(metadataProvider.getClass().getCanonicalName());
if (metadataFilterChain != null) {
metadataProvider.setMetadataFilter(metadataFilterChain);
}
LOGGER.debug("Initializing metadata resolver for [{}]", resource);
metadataProvider.initialize();
final List<MetadataResolver> resolvers = new ArrayList<>();
resolvers.add(metadataProvider);
return resolvers;
} catch (final Exception ex) {
LOGGER.warn("Could not initialize metadata resolver. Resource will be ignored", ex);
}
return new ArrayList<>();
}
use of org.opensaml.saml.metadata.resolver.impl.DOMMetadataResolver in project cas by apereo.
the class ChainingMetadataResolverCacheLoader method resolveClasspathBasedMetadataResource.
private void resolveClasspathBasedMetadataResource(final SamlRegisteredService service, final List<MetadataResolver> metadataResolvers, final String metadataLocation, final AbstractResource metadataResource) {
try (InputStream in = metadataResource.getInputStream()) {
LOGGER.debug("Parsing metadata from [{}]", metadataLocation);
final Document document = this.configBean.getParserPool().parse(in);
final Element metadataRoot = document.getDocumentElement();
final DOMMetadataResolver metadataProvider = new DOMMetadataResolver(metadataRoot);
buildSingleMetadataResolver(metadataProvider, service);
metadataResolvers.add(metadataProvider);
} catch (final Exception e) {
throw Throwables.propagate(e);
}
}
Aggregations