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
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:
-
Nested Class Summary
Nested classes/interfaces inherited from class se.swedenconnect.opensaml.saml2.metadata.provider.AbstractMetadataProvider
AbstractMetadataProvider.EntityDescriptorIterator
-
Constructor Summary
ConstructorDescriptionCompositeMetadataProvider
(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. -
Method Summary
Modifier and TypeMethodDescriptionprotected org.opensaml.saml.metadata.resolver.filter.MetadataFilter
Returnsnull
since theCompositeMetadataResolver
doesn't perform any filtering.protected void
createMetadataResolver
(boolean requireValidMetadata, boolean failFastInitialization, org.opensaml.saml.metadata.resolver.filter.MetadataFilter filter) Creates the specificMetadataResolver
instance for the provider implementation.protected void
Destroys the metadata resolver.getID()
Returns the identifier for the provider.Returns the time the currently available metadata was last updated.org.opensaml.core.xml.XMLObject
Collects all metadata from all underlying providers and creates anEntitiesDescriptor
element.org.opensaml.saml.metadata.resolver.MetadataResolver
Returns the underlying OpenSAML metadata resolver.Gets the underlying providers.protected void
Initializes the metadata resolver.void
setCacheDuration
(Duration cacheDuration) Assigns thecacheDuration
to assign to the aggregated metadata (returned viagetMetadata()
).void
setExclusionPredicates
(List<Predicate<org.opensaml.saml.saml2.metadata.EntityDescriptor>> exclusionPredicates) It is not possible to set configuration for metadata for aCompositeMetadataResolver
.void
setFailFastInitialization
(boolean failFast) It is not possible to set configuration for metadata for aCompositeMetadataResolver
.void
setInclusionPredicates
(List<Predicate<org.opensaml.saml.saml2.metadata.EntityDescriptor>> inclusionPredicates) It is not possible to set configuration for metadata for aCompositeMetadataResolver
.void
setPerformSchemaValidation
(boolean performSchemaValidation) It is not possible to set configuration for metadata for aCompositeMetadataResolver
.void
setRequireValidMetadata
(boolean requireValidMetadata) It is not possible to set configuration for metadata for aCompositeMetadataResolver
.void
setSignatureVerificationCertificate
(X509Certificate signatureVerificationCertificate) It is not possible to set configuration for metadata for aCompositeMetadataResolver
.void
setValidity
(Duration validity) Assigns how long the aggregated metadata (returned viagetMetadata()
) should be valid.Methods inherited from class se.swedenconnect.opensaml.saml2.metadata.provider.AbstractMetadataProvider
doDestroy, doInitialize, getEntityDescriptor, getEntityDescriptor, getIdentityProviders, getMetadataDOM, getServiceProviders, getSignatureVerificationCertificates, iterator, iterator, refresh, setKeepOnlySpAndIdps, setMetadata, setSignatureVerificationCertificates
Methods inherited from class net.shibboleth.shared.component.AbstractInitializableComponent
checkComponentActive, checkSetterPreconditions, destroy, ifDestroyedThrowDestroyedComponentException, ifInitializedThrowUnmodifiabledComponentException, ifNotInitializedThrowUninitializedComponentException, initialize, isDestroyed, isInitialized
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.shibboleth.shared.component.DestructableComponent
destroy, isDestroyed
Methods inherited from interface net.shibboleth.shared.component.InitializableComponent
initialize, isInitialized
-
Constructor Details
-
CompositeMetadataProvider
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 theName
attribute for theEntitiesDescriptor
that will be returned bygetMetadata()
.- Parameters:
id
- the identifier for the provider (may not be changed later on)metadataProviders
- a list of providers
-
-
Method Details
-
getProviders
Gets the underlying providers.- Returns:
- a list of the underlying metadata providers
-
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 anEntitiesDescriptor
element. Any duplicate entity ID:s will be removed.- Specified by:
getMetadata
in interfaceMetadataProvider
- Overrides:
getMetadata
in classAbstractMetadataProvider
- Returns:
- an XML element
-
getLastUpdate
Returns the time the currently available metadata was last updated.- Specified by:
getLastUpdate
in interfaceMetadataProvider
- Overrides:
getLastUpdate
in classAbstractMetadataProvider
- 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 specificMetadataResolver
instance for the provider implementation.The
filter
parameter is aMetadataFilter
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 classAbstractMetadataProvider
- Parameters:
requireValidMetadata
- should be passed intoMetadataResolver.setRequireValidMetadata(boolean)
failFastInitialization
- should be passed intoAbstractMetadataResolver.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()Returnsnull
since theCompositeMetadataResolver
doesn't perform any filtering.- Overrides:
createFilter
in classAbstractMetadataProvider
- Returns:
- a metadata filter
-
initializeMetadataResolver
protected void initializeMetadataResolver() throws net.shibboleth.shared.component.ComponentInitializationExceptionInitializes the metadata resolver.- Specified by:
initializeMetadataResolver
in classAbstractMetadataProvider
- Throws:
net.shibboleth.shared.component.ComponentInitializationException
- for initialization errors
-
destroyMetadataResolver
protected void destroyMetadataResolver()Destroys the metadata resolver.- Specified by:
destroyMetadataResolver
in classAbstractMetadataProvider
-
setRequireValidMetadata
public void setRequireValidMetadata(boolean requireValidMetadata) It is not possible to set configuration for metadata for aCompositeMetadataResolver
. This should be done on each of the underlying resolvers.- Overrides:
setRequireValidMetadata
in classAbstractMetadataProvider
- 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 aCompositeMetadataResolver
. This should be done on each of the underlying resolvers.- Overrides:
setFailFastInitialization
in classAbstractMetadataProvider
- 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 aCompositeMetadataResolver
. This should be done on each of the underlying resolvers.- Overrides:
setInclusionPredicates
in classAbstractMetadataProvider
- 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 aCompositeMetadataResolver
. This should be done on each of the underlying resolvers.- Overrides:
setExclusionPredicates
in classAbstractMetadataProvider
- Parameters:
exclusionPredicates
- predicates- See Also:
-
setSignatureVerificationCertificate
It is not possible to set configuration for metadata for aCompositeMetadataResolver
. This should be done on each of the underlying resolvers.- Overrides:
setSignatureVerificationCertificate
in classAbstractMetadataProvider
- Parameters:
signatureVerificationCertificate
- the certificate to assign
-
setPerformSchemaValidation
public void setPerformSchemaValidation(boolean performSchemaValidation) It is not possible to set configuration for metadata for aCompositeMetadataResolver
. This should be done on each of the underlying resolvers.- Overrides:
setPerformSchemaValidation
in classAbstractMetadataProvider
- Parameters:
performSchemaValidation
- whether schema validation should be performed
-
setValidity
Assigns how long the aggregated metadata (returned viagetMetadata()
) should be valid. If not assigned, the provider will calculate thevalidUntil
based on the lowestvalidUntil
value from the underlying providers.- Parameters:
validity
- the validity
-
setCacheDuration
Assigns thecacheDuration
to assign to the aggregated metadata (returned viagetMetadata()
). If not assigned thecacheDuration
will be based on the lowestcacheDuration
value from the underlying providers.- Parameters:
cacheDuration
- the cache duration
-