Search in sources :

Example 1 with HttpClientMultithreadedDownloader

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);
}
Also used : HttpClientMultithreadedDownloader(org.apereo.cas.util.http.HttpClientMultithreadedDownloader) FileBackedHTTPMetadataResolver(org.opensaml.saml.metadata.resolver.impl.FileBackedHTTPMetadataResolver) SamlIdPProperties(org.apereo.cas.configuration.model.support.saml.idp.SamlIdPProperties) File(java.io.File)

Aggregations

File (java.io.File)1 SamlIdPProperties (org.apereo.cas.configuration.model.support.saml.idp.SamlIdPProperties)1 HttpClientMultithreadedDownloader (org.apereo.cas.util.http.HttpClientMultithreadedDownloader)1 FileBackedHTTPMetadataResolver (org.opensaml.saml.metadata.resolver.impl.FileBackedHTTPMetadataResolver)1