Class CompositeMetadataProvider

java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
se.swedenconnect.opensaml.saml2.metadata.provider.AbstractMetadataProvider
se.swedenconnect.opensaml.saml2.metadata.provider.CompositeMetadataProvider
All Implemented Interfaces:
net.shibboleth.shared.component.Component, net.shibboleth.shared.component.DestructableComponent, net.shibboleth.shared.component.InitializableComponent, MetadataProvider

public class CompositeMetadataProvider extends AbstractMetadataProvider
A metadata provider that collects its metadata from multiple sources (providers).

It is recommended that all providers installed have the failFastInitialization property set to false. Otherwise a failing provider will shut down the entire compostite provider.

Author:
Martin Lindström (martin.lindstrom@litsec.se)
See Also:
  • CompositeMetadataResolver
  • Constructor Details

    • CompositeMetadataProvider

      public CompositeMetadataProvider(String id, List<MetadataProvider> metadataProviders)
      Constructs a composite metadata provider by assigning it a list of provider instances that it shall read its metadata from.

      The id parameter will also by used as the Name attribute for the EntitiesDescriptor that will be returned by getMetadata().

      Parameters:
      id - the identifier for the provider (may not be changed later on)
      metadataProviders - a list of providers
  • Method Details

    • getProviders

      public List<MetadataProvider> getProviders()
      Gets the underlying providers.
      Returns:
      a list of the underlying metadata providers
    • getID

      public String getID()
      Returns the identifier for the provider.
      Returns:
      the identifier
    • getMetadataResolver

      public org.opensaml.saml.metadata.resolver.MetadataResolver getMetadataResolver()
      Returns the underlying OpenSAML metadata resolver.
      Returns:
      OpenSAML metadata resolver
    • getMetadata

      public org.opensaml.core.xml.XMLObject getMetadata()
      Collects all metadata from all underlying providers and creates an EntitiesDescriptor element. Any duplicate entity ID:s will be removed.
      Specified by:
      getMetadata in interface MetadataProvider
      Overrides:
      getMetadata in class AbstractMetadataProvider
      Returns:
      an XML element
    • getLastUpdate

      public Instant getLastUpdate()
      Returns the time the currently available metadata was last updated.
      Specified by:
      getLastUpdate in interface MetadataProvider
      Overrides:
      getLastUpdate in class AbstractMetadataProvider
      Returns:
      time when the currently metadata was last updated, or null if no metadata has been successfully loaded
    • createMetadataResolver

      protected void createMetadataResolver(boolean requireValidMetadata, boolean failFastInitialization, org.opensaml.saml.metadata.resolver.filter.MetadataFilter filter) throws net.shibboleth.shared.resolver.ResolverException
      Creates the specific MetadataResolver instance for the provider implementation.

      The filter parameter is a MetadataFilter that must be installed for the resolver. Any other filters that should be installed by the specific instance should be placed last in a filter chain.

      Specified by:
      createMetadataResolver in class AbstractMetadataProvider
      Parameters:
      requireValidMetadata - should be passed into MetadataResolver.setRequireValidMetadata(boolean)
      failFastInitialization - should be passed into AbstractMetadataResolver.setFailFastInitialization(boolean) (if applicable)
      filter - filter that must be installed for the resolver
      Throws:
      net.shibboleth.shared.resolver.ResolverException - for errors creating the resolver
    • createFilter

      protected org.opensaml.saml.metadata.resolver.filter.MetadataFilter createFilter()
      Returns null since the CompositeMetadataResolver doesn't perform any filtering.
      Overrides:
      createFilter in class AbstractMetadataProvider
      Returns:
      a metadata filter
    • initializeMetadataResolver

      protected void initializeMetadataResolver() throws net.shibboleth.shared.component.ComponentInitializationException
      Initializes the metadata resolver.
      Specified by:
      initializeMetadataResolver in class AbstractMetadataProvider
      Throws:
      net.shibboleth.shared.component.ComponentInitializationException - for initialization errors
    • destroyMetadataResolver

      protected void destroyMetadataResolver()
      Destroys the metadata resolver.
      Specified by:
      destroyMetadataResolver in class AbstractMetadataProvider
    • setRequireValidMetadata

      public void setRequireValidMetadata(boolean requireValidMetadata)
      It is not possible to set configuration for metadata for a CompositeMetadataResolver. This should be done on each of the underlying resolvers.
      Overrides:
      setRequireValidMetadata in class AbstractMetadataProvider
      Parameters:
      requireValidMetadata - whether the metadata returned by queries must be valid
    • setFailFastInitialization

      public void setFailFastInitialization(boolean failFast)
      It is not possible to set configuration for metadata for a CompositeMetadataResolver. This should be done on each of the underlying resolvers.
      Overrides:
      setFailFastInitialization in class AbstractMetadataProvider
      Parameters:
      failFast - whether problems during initialization should cause the provider to fail
    • setInclusionPredicates

      public void setInclusionPredicates(List<Predicate<org.opensaml.saml.saml2.metadata.EntityDescriptor>> inclusionPredicates)
      It is not possible to set configuration for metadata for a CompositeMetadataResolver. This should be done on each of the underlying resolvers.
      Overrides:
      setInclusionPredicates in class AbstractMetadataProvider
      Parameters:
      inclusionPredicates - predicates
      See Also:
    • setExclusionPredicates

      public void setExclusionPredicates(List<Predicate<org.opensaml.saml.saml2.metadata.EntityDescriptor>> exclusionPredicates)
      It is not possible to set configuration for metadata for a CompositeMetadataResolver. This should be done on each of the underlying resolvers.
      Overrides:
      setExclusionPredicates in class AbstractMetadataProvider
      Parameters:
      exclusionPredicates - predicates
      See Also:
    • setSignatureVerificationCertificate

      public void setSignatureVerificationCertificate(X509Certificate signatureVerificationCertificate)
      It is not possible to set configuration for metadata for a CompositeMetadataResolver. This should be done on each of the underlying resolvers.
      Overrides:
      setSignatureVerificationCertificate in class AbstractMetadataProvider
      Parameters:
      signatureVerificationCertificate - the certificate to assign
    • setPerformSchemaValidation

      public void setPerformSchemaValidation(boolean performSchemaValidation)
      It is not possible to set configuration for metadata for a CompositeMetadataResolver. This should be done on each of the underlying resolvers.
      Overrides:
      setPerformSchemaValidation in class AbstractMetadataProvider
      Parameters:
      performSchemaValidation - whether schema validation should be performed
    • setValidity

      public void setValidity(Duration validity)
      Assigns how long the aggregated metadata (returned via getMetadata()) should be valid. If not assigned, the provider will calculate the validUntil based on the lowest validUntil value from the underlying providers.
      Parameters:
      validity - the validity
    • setCacheDuration

      public void setCacheDuration(Duration cacheDuration)
      Assigns the cacheDuration to assign to the aggregated metadata (returned via getMetadata()). If not assigned the cacheDuration will be based on the lowest cacheDuration value from the underlying providers.
      Parameters:
      cacheDuration - the cache duration