public abstract class AbstractMetadataResolver extends net.shibboleth.utilities.java.support.component.AbstractIdentifiableInitializableComponent implements MetadataResolver
Modifier and Type | Class and Description |
---|---|
protected class |
AbstractMetadataResolver.EntityBackingStore
The collection of data which provides the backing store for the processed metadata.
|
Modifier and Type | Field and Description |
---|---|
private net.shibboleth.utilities.java.support.resolver.CriterionPredicateRegistry<EntityDescriptor> |
criterionPredicateRegistry
Registry used in resolving predicates from criteria.
|
private AbstractMetadataResolver.EntityBackingStore |
entityBackingStore
Backing store for runtime EntityDescriptor data.
|
private boolean |
failFastInitialization
Whether problems during initialization should cause the provider to fail or go on without metadata.
|
private org.slf4j.Logger |
log
Class logger.
|
private String |
logPrefix
Logging prefix.
|
private MetadataFilter |
mdFilter
Filter applied to all metadata.
|
private net.shibboleth.utilities.java.support.xml.ParserPool |
parser
Pool of parsers used to process XML.
|
private boolean |
requireValidMetadata
Whether metadata is required to be valid.
|
private boolean |
satisfyAnyPredicates
Flag which determines whether predicates used in filtering are connected by
a logical 'OR' (true) or by logical 'AND' (false).
|
private org.opensaml.core.xml.io.UnmarshallerFactory |
unmarshallerFactory
Unmarshaller factory used to get an unmarshaller for the metadata DOM.
|
private boolean |
useDefaultPredicateRegistry
Flag which determines whether the default predicate registry will be used if one is not supplied explicitly.
|
Constructor and Description |
---|
AbstractMetadataResolver()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected AbstractMetadataResolver.EntityBackingStore |
createNewBackingStore()
Create a new backing store instance for EntityDescriptor data.
|
protected void |
doDestroy() |
protected void |
doInitialize() |
protected org.opensaml.core.xml.XMLObject |
filterMetadata(org.opensaml.core.xml.XMLObject metadata)
Filters the given metadata.
|
protected AbstractMetadataResolver.EntityBackingStore |
getBackingStore()
Get the EntityDescriptor backing store currently in use by the metadata resolver.
|
net.shibboleth.utilities.java.support.resolver.CriterionPredicateRegistry<EntityDescriptor> |
getCriterionPredicateRegistry()
Get the registry used in resolving predicates from criteria.
|
protected String |
getLogPrefix()
Return a prefix for logging messages for this component.
|
MetadataFilter |
getMetadataFilter() |
net.shibboleth.utilities.java.support.xml.ParserPool |
getParserPool()
Gets the pool of parsers to use to parse XML.
|
protected org.opensaml.core.xml.io.UnmarshallerFactory |
getUnmarshallerFactory()
Get the XMLObject unmarshaller factory to use.
|
protected void |
indexEntityDescriptor(EntityDescriptor entityDescriptor,
AbstractMetadataResolver.EntityBackingStore backingStore)
Index the specified entity descriptor, updating the specified entity backing store instance as necessary.
|
protected void |
initMetadataResolver()
Subclasses should override this method to perform any initialization logic necessary.
|
boolean |
isFailFastInitialization()
Gets whether problems during initialization should cause the provider to fail or go on without metadata.
|
boolean |
isRequireValidMetadata() |
boolean |
isSatisfyAnyPredicates()
Get the flag indicating whether resolved credentials may satisfy any predicates
(i.e.
|
boolean |
isUseDefaultPredicateRegistry()
Get the flag which determines whether the default predicate registry will be used
if one is not supplied explicitly.
|
protected boolean |
isValid(org.opensaml.core.xml.XMLObject descriptor)
Returns whether the given descriptor is valid.
|
protected List<EntityDescriptor> |
lookupEntityID(String entityID)
Get list of descriptors matching an entityID.
|
protected List<EntityDescriptor> |
lookupIndexedEntityID(String entityID)
Lookup the specified entityID from the index.
|
protected Iterable<EntityDescriptor> |
predicateFilterCandidates(Iterable<EntityDescriptor> candidates,
net.shibboleth.utilities.java.support.resolver.CriteriaSet criteria,
boolean onEmptyPredicatesReturnEmpty)
Filter the supplied candidates by resolving predicates from the supplied criteria and applying
the predicates to return a filtered
Iterable . |
protected void |
preProcessEntitiesDescriptor(EntitiesDescriptor entitiesDescriptor,
AbstractMetadataResolver.EntityBackingStore backingStore)
Pre-process the specified entities descriptor, updating the specified entity backing store instance as necessary.
|
protected void |
preProcessEntityDescriptor(EntityDescriptor entityDescriptor,
AbstractMetadataResolver.EntityBackingStore backingStore)
Pre-process the specified entity descriptor, updating the specified entity backing store instance as necessary.
|
protected void |
releaseMetadataDOM(org.opensaml.core.xml.XMLObject metadata)
Releases the DOM representation from the metadata object.
|
protected void |
removeByEntityID(String entityID,
AbstractMetadataResolver.EntityBackingStore backingStore)
Remove from the backing store all metadata for the entity with the given entity ID.
|
EntityDescriptor |
resolveSingle(net.shibboleth.utilities.java.support.resolver.CriteriaSet criteria) |
protected void |
setBackingStore(AbstractMetadataResolver.EntityBackingStore newBackingStore)
Set the EntityDescriptor backing store currently in use by the metadata resolver.
|
void |
setCriterionPredicateRegistry(net.shibboleth.utilities.java.support.resolver.CriterionPredicateRegistry<EntityDescriptor> registry)
Set the registry used in resolving predicates from criteria.
|
void |
setFailFastInitialization(boolean failFast)
Sets whether problems during initialization should cause the provider to fail or go on without metadata.
|
void |
setMetadataFilter(MetadataFilter newFilter) |
void |
setParserPool(net.shibboleth.utilities.java.support.xml.ParserPool pool)
Sets the pool of parsers to use to parse XML.
|
void |
setRequireValidMetadata(boolean require) |
void |
setSatisfyAnyPredicates(boolean flag)
Set the flag indicating whether resolved credentials may satisfy any predicates
(i.e.
|
void |
setUseDefaultPredicateRegistry(boolean flag)
Set the flag which determines whether the default predicate registry will be used
if one is not supplied explicitly.
|
protected org.opensaml.core.xml.XMLObject |
unmarshallMetadata(InputStream metadataInput)
Unmarshalls the metadata from the given stream.
|
setId
getId
destroy, initialize, isDestroyed, isInitialized
private final org.slf4j.Logger log
private org.opensaml.core.xml.io.UnmarshallerFactory unmarshallerFactory
private boolean requireValidMetadata
private MetadataFilter mdFilter
private String logPrefix
private boolean failFastInitialization
private AbstractMetadataResolver.EntityBackingStore entityBackingStore
private net.shibboleth.utilities.java.support.xml.ParserPool parser
private boolean satisfyAnyPredicates
private net.shibboleth.utilities.java.support.resolver.CriterionPredicateRegistry<EntityDescriptor> criterionPredicateRegistry
private boolean useDefaultPredicateRegistry
public boolean isRequireValidMetadata()
isRequireValidMetadata
in interface MetadataResolver
public void setRequireValidMetadata(boolean require)
setRequireValidMetadata
in interface MetadataResolver
@Nullable public MetadataFilter getMetadataFilter()
getMetadataFilter
in interface MetadataResolver
public void setMetadataFilter(@Nullable MetadataFilter newFilter)
setMetadataFilter
in interface MetadataResolver
public boolean isFailFastInitialization()
public void setFailFastInitialization(boolean failFast)
failFast
- whether problems during initialization should cause the provider to fail@Nonnull public net.shibboleth.utilities.java.support.xml.ParserPool getParserPool()
public void setParserPool(@Nonnull net.shibboleth.utilities.java.support.xml.ParserPool pool)
pool
- pool of parsers to use to parse XMLpublic boolean isSatisfyAnyPredicates()
Defaults to false.
public void setSatisfyAnyPredicates(boolean flag)
Defaults to false.
flag
- true if must satisfy all, false otherwise@NonnullAfterInit public net.shibboleth.utilities.java.support.resolver.CriterionPredicateRegistry<EntityDescriptor> getCriterionPredicateRegistry()
public void setCriterionPredicateRegistry(@Nullable net.shibboleth.utilities.java.support.resolver.CriterionPredicateRegistry<EntityDescriptor> registry)
registry
- the registry instance to usepublic boolean isUseDefaultPredicateRegistry()
Defaults to true.
public void setUseDefaultPredicateRegistry(boolean flag)
Defaults to true.
flag
- true if should use default registry, false otherwise@Nullable public EntityDescriptor resolveSingle(net.shibboleth.utilities.java.support.resolver.CriteriaSet criteria) throws net.shibboleth.utilities.java.support.resolver.ResolverException
resolveSingle
in interface net.shibboleth.utilities.java.support.resolver.Resolver<EntityDescriptor,net.shibboleth.utilities.java.support.resolver.CriteriaSet>
net.shibboleth.utilities.java.support.resolver.ResolverException
protected org.opensaml.core.xml.io.UnmarshallerFactory getUnmarshallerFactory()
protected final void doInitialize() throws net.shibboleth.utilities.java.support.component.ComponentInitializationException
doInitialize
in class net.shibboleth.utilities.java.support.component.AbstractIdentifiedInitializableComponent
net.shibboleth.utilities.java.support.component.ComponentInitializationException
protected void doDestroy()
doDestroy
in class net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
protected void initMetadataResolver() throws net.shibboleth.utilities.java.support.component.ComponentInitializationException
net.shibboleth.utilities.java.support.component.ComponentInitializationException
- thrown if there is a problem initializing the provider@Nonnull protected org.opensaml.core.xml.XMLObject unmarshallMetadata(@Nonnull InputStream metadataInput) throws org.opensaml.core.xml.io.UnmarshallingException
metadataInput
- the input reader to the metadata.org.opensaml.core.xml.io.UnmarshallingException
- thrown if the metadata can no be unmarshalled@Nullable protected org.opensaml.core.xml.XMLObject filterMetadata(@Nullable org.opensaml.core.xml.XMLObject metadata) throws FilterException
metadata
- the metadata to be filteredFilterException
- thrown if there is an error filtering the metadataprotected void releaseMetadataDOM(@Nullable org.opensaml.core.xml.XMLObject metadata)
metadata
- the metadata objectprotected boolean isValid(@Nullable org.opensaml.core.xml.XMLObject descriptor)
descriptor
- the descriptor to check@Nonnull @NonnullElements protected List<EntityDescriptor> lookupEntityID(@Nonnull @NotEmpty String entityID) throws net.shibboleth.utilities.java.support.resolver.ResolverException
entityID
- entityID to lookupnet.shibboleth.utilities.java.support.resolver.ResolverException
- if an error occurs@Nonnull @NonnullElements protected List<EntityDescriptor> lookupIndexedEntityID(@Nonnull @NotEmpty String entityID)
entityID
- the entityID to lookup@Nonnull protected AbstractMetadataResolver.EntityBackingStore createNewBackingStore()
setBackingStore(EntityBackingStore)
to make it the effective
instance in use.@Nonnull protected AbstractMetadataResolver.EntityBackingStore getBackingStore()
protected void setBackingStore(@Nonnull AbstractMetadataResolver.EntityBackingStore newBackingStore)
newBackingStore
- the new entity backing storeprotected void preProcessEntityDescriptor(@Nonnull EntityDescriptor entityDescriptor, @Nonnull AbstractMetadataResolver.EntityBackingStore backingStore)
entityDescriptor
- the target entity descriptor to processbackingStore
- the backing store instance to updateprotected void removeByEntityID(@Nonnull String entityID, @Nonnull AbstractMetadataResolver.EntityBackingStore backingStore)
entityID
- the entity ID of the metadata to removebackingStore
- the backing store instance to updateprotected void indexEntityDescriptor(@Nonnull EntityDescriptor entityDescriptor, @Nonnull AbstractMetadataResolver.EntityBackingStore backingStore)
entityDescriptor
- the target entity descriptor to processbackingStore
- the backing store instance to updateprotected void preProcessEntitiesDescriptor(@Nonnull EntitiesDescriptor entitiesDescriptor, AbstractMetadataResolver.EntityBackingStore backingStore)
entitiesDescriptor
- the target entities descriptor to processbackingStore
- the backing store instance to updateprotected Iterable<EntityDescriptor> predicateFilterCandidates(@Nonnull Iterable<EntityDescriptor> candidates, @Nonnull net.shibboleth.utilities.java.support.resolver.CriteriaSet criteria, boolean onEmptyPredicatesReturnEmpty) throws net.shibboleth.utilities.java.support.resolver.ResolverException
Iterable
.candidates
- the candidates to evaluatecriteria
- the criteria set to evaluateonEmptyPredicatesReturnEmpty
- if true and no predicates are supplied, then return an empty iterable;
otherwise return the original input candidatesnet.shibboleth.utilities.java.support.resolver.ResolverException
- if there is a fatal error during resolutionCopyright © 1999–2020 Shibboleth Consortium. All rights reserved.