Search in sources :

Example 1 with ResourceBackedMetadataResolver

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

the class SamlIdPConfiguration method casSamlIdPMetadataResolver.

@Bean
public MetadataResolver casSamlIdPMetadataResolver() {
    try {
        final SamlIdPProperties idp = casProperties.getAuthn().getSamlIdp();
        final ResourceBackedMetadataResolver resolver = new ResourceBackedMetadataResolver(ResourceHelper.of(new FileSystemResource(idp.getMetadata().getMetadataFile())));
        resolver.setParserPool(this.openSamlConfigBean.getParserPool());
        resolver.setFailFastInitialization(idp.getMetadata().isFailFast());
        resolver.setRequireValidMetadata(idp.getMetadata().isRequireValidMetadata());
        resolver.setId(idp.getEntityId());
        resolver.initialize();
        return resolver;
    } catch (final Exception e) {
        throw new BeanCreationException(e.getMessage(), e);
    }
}
Also used : BeanCreationException(org.springframework.beans.factory.BeanCreationException) SamlIdPProperties(org.apereo.cas.configuration.model.support.saml.idp.SamlIdPProperties) ResourceBackedMetadataResolver(org.opensaml.saml.metadata.resolver.impl.ResourceBackedMetadataResolver) FileSystemResource(org.springframework.core.io.FileSystemResource) BeanCreationException(org.springframework.beans.factory.BeanCreationException) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) OpenSamlConfigBean(org.apereo.cas.support.saml.OpenSamlConfigBean) Bean(org.springframework.context.annotation.Bean)

Example 2 with ResourceBackedMetadataResolver

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

the class ChainingMetadataResolverCacheLoader method resolveFileSystemBasedMetadataResource.

private void resolveFileSystemBasedMetadataResource(final SamlRegisteredService service, final List<MetadataResolver> metadataResolvers, final AbstractResource metadataResource) throws Exception {
    final File metadataFile = metadataResource.getFile();
    final AbstractMetadataResolver metadataResolver;
    if (metadataFile.isDirectory()) {
        metadataResolver = new LocalDynamicMetadataResolver(new FilesystemLoadSaveManager<>(metadataFile, configBean.getParserPool()));
    } else {
        metadataResolver = new ResourceBackedMetadataResolver(ResourceHelper.of(metadataResource));
    }
    buildSingleMetadataResolver(metadataResolver, service);
    metadataResolvers.add(metadataResolver);
}
Also used : ResourceBackedMetadataResolver(org.opensaml.saml.metadata.resolver.impl.ResourceBackedMetadataResolver) AbstractMetadataResolver(org.opensaml.saml.metadata.resolver.impl.AbstractMetadataResolver) LocalDynamicMetadataResolver(org.opensaml.saml.metadata.resolver.impl.LocalDynamicMetadataResolver) FilesystemLoadSaveManager(org.opensaml.core.xml.persist.FilesystemLoadSaveManager) File(java.io.File)

Aggregations

ResourceBackedMetadataResolver (org.opensaml.saml.metadata.resolver.impl.ResourceBackedMetadataResolver)2 File (java.io.File)1 SamlIdPProperties (org.apereo.cas.configuration.model.support.saml.idp.SamlIdPProperties)1 OpenSamlConfigBean (org.apereo.cas.support.saml.OpenSamlConfigBean)1 FilesystemLoadSaveManager (org.opensaml.core.xml.persist.FilesystemLoadSaveManager)1 AbstractMetadataResolver (org.opensaml.saml.metadata.resolver.impl.AbstractMetadataResolver)1 LocalDynamicMetadataResolver (org.opensaml.saml.metadata.resolver.impl.LocalDynamicMetadataResolver)1 BeanCreationException (org.springframework.beans.factory.BeanCreationException)1 ConditionalOnMissingBean (org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean)1 Bean (org.springframework.context.annotation.Bean)1 FileSystemResource (org.springframework.core.io.FileSystemResource)1