use of org.apereo.cas.util.http.HttpClientMultithreadedDownloader in project cas by apereo.
the class ChainingMetadataResolverCacheLoader method resolveUrlBasedMetadataResource.
private void resolveUrlBasedMetadataResource(final SamlRegisteredService service, final List<MetadataResolver> metadataResolvers, final AbstractResource metadataResource) throws Exception {
final SamlIdPProperties.Metadata md = casProperties.getAuthn().getSamlIdp().getMetadata();
final File backupDirectory = new File(md.getLocation().getFile(), "metadata-backups");
final File backupFile = new File(backupDirectory, metadataResource.getFilename());
LOGGER.debug("Metadata backup directory is designated to be [{}]", backupDirectory.getCanonicalPath());
FileUtils.forceMkdir(backupDirectory);
LOGGER.debug("Metadata backup file will be at [{}]", backupFile.getCanonicalPath());
FileUtils.forceMkdirParent(backupFile);
final HttpClientMultithreadedDownloader downloader = new HttpClientMultithreadedDownloader(metadataResource, backupFile);
final FileBackedHTTPMetadataResolver metadataProvider = new FileBackedHTTPMetadataResolver(this.httpClient.getWrappedHttpClient(), metadataResource.getURL().toExternalForm(), backupFile.getCanonicalPath());
buildSingleMetadataResolver(metadataProvider, service);
metadataResolvers.add(metadataProvider);
}
Aggregations