Class AbstractOIDCMetadataResolver<MetadataIdentifier,MetadataType>
- java.lang.Object
-
- net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
-
- net.shibboleth.utilities.java.support.component.AbstractIdentifiedInitializableComponent
-
- net.shibboleth.utilities.java.support.component.AbstractIdentifiableInitializableComponent
-
- net.shibboleth.oidc.metadata.impl.AbstractOIDCMetadataResolver<MetadataIdentifier,MetadataType>
-
- Type Parameters:
MetadataIdentifier- the type used to identify the metadataMetadataType- the metadata type
- All Implemented Interfaces:
OIDCMetadataResolver<MetadataType>,Component,DestructableComponent,IdentifiableComponent,IdentifiedComponent,InitializableComponent,Resolver<MetadataType,CriteriaSet>
- Direct Known Subclasses:
JSONMapMetadataResolver,OIDCMapBasedMetadataResolver,OIDCMetadataPolicyResolver,OIDCProviderMetadataResolver
public abstract class AbstractOIDCMetadataResolver<MetadataIdentifier,MetadataType> extends AbstractIdentifiableInitializableComponent implements OIDCMetadataResolver<MetadataType>
An abstract metadata resolver which supports any type of metadata.
-
-
Field Summary
Fields Modifier and Type Field Description private MetadataCache<MetadataType>cacheThe metadata cache.private CriterionPredicateRegistry<MetadataType>criterionPredicateRegistryRegistry used in resolving predicates from criteria.private booleanfailFastInitializationWhether problems during initialization should cause the provider to fail or go on without metadata.private org.slf4j.LoggerlogClass logger.private StringlogPrefixLogging prefix.private booleansatisfyAnyPredicatesFlag which determines whether predicates used in filtering are connected by a logical 'OR' (true) or by logical 'AND' (false).
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractOIDCMetadataResolver(MetadataCache<MetadataType> metadataCache)Constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voiddoDestroy()protected voiddoInitialize()protected MetadataCache<MetadataType>getCache()Get the metadata cache currently in use by the metadata resolver.CriterionPredicateRegistry<MetadataType>getCriterionPredicateRegistry()Get the registry used in resolving predicates from criteria.protected StringgetLogPrefix()Return a prefix for logging messages for this component.protected abstract voidinitMetadataResolver()Initialise this metadata provider.booleanisFailFastInitialization()Gets whether problems during initialization should cause the provider to fail or go on without metadata.booleanisSatisfyAnyPredicates()Get the flag indicating whether resolved credentials may satisfy any predicates (i.e.protected Iterable<MetadataType>predicateFilterCandidates(Iterable<MetadataType> candidates, CriteriaSet criteria, boolean onEmptyPredicatesReturnEmpty)Filter the supplied candidates by resolving predicates from the supplied criteria and applying the predicates to return a filteredIterable.Iterable<MetadataType>resolve(CriteriaSet criteria)MetadataTyperesolveSingle(CriteriaSet criteria)voidsetCriterionPredicateRegistry(CriterionPredicateRegistry<MetadataType> registry)Set the registry used in resolving predicates from criteria.voidsetFailFastInitialization(boolean failFast)Sets whether problems during initialization should cause the provider to fail or go on without metadata.voidsetSatisfyAnyPredicates(boolean flag)Set the flag indicating whether resolved credentials may satisfy any predicates (i.e.-
Methods inherited from class net.shibboleth.utilities.java.support.component.AbstractIdentifiableInitializableComponent
setId
-
Methods inherited from class net.shibboleth.utilities.java.support.component.AbstractIdentifiedInitializableComponent
getId
-
Methods inherited from class net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
destroy, 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.utilities.java.support.component.IdentifiedComponent
getId
-
-
-
-
Field Detail
-
log
private final org.slf4j.Logger log
Class logger.
-
logPrefix
private String logPrefix
Logging prefix.
-
cache
@Nonnull private final MetadataCache<MetadataType> cache
The metadata cache.
-
satisfyAnyPredicates
private boolean satisfyAnyPredicates
Flag which determines whether predicates used in filtering are connected by a logical 'OR' (true) or by logical 'AND' (false). Defaults to false.
-
criterionPredicateRegistry
@NonnullAfterInit private CriterionPredicateRegistry<MetadataType> criterionPredicateRegistry
Registry used in resolving predicates from criteria.
-
failFastInitialization
private boolean failFastInitialization
Whether problems during initialization should cause the provider to fail or go on without metadata. The assumption being that in most cases a provider will recover at some point in the future. Default: true.
-
-
Constructor Detail
-
AbstractOIDCMetadataResolver
protected AbstractOIDCMetadataResolver(@Nonnull MetadataCache<MetadataType> metadataCache)Constructor.- Parameters:
metadataCache- the metadata cache to use.
-
-
Method Detail
-
getLogPrefix
@Nonnull @NotEmpty protected String getLogPrefix()
Return a prefix for logging messages for this component.- Returns:
- a string for insertion at the beginning of any log messages
-
resolveSingle
@Nullable public MetadataType resolveSingle(CriteriaSet criteria) throws ResolverException
- Specified by:
resolveSinglein interfaceResolver<MetadataIdentifier,MetadataType>- Throws:
ResolverException
-
resolve
@Nonnull public Iterable<MetadataType> resolve(@Nonnull CriteriaSet criteria) throws ResolverException
- Specified by:
resolvein interfaceResolver<MetadataIdentifier,MetadataType>- Throws:
ResolverException
-
predicateFilterCandidates
protected Iterable<MetadataType> predicateFilterCandidates(@Nonnull Iterable<MetadataType> candidates, @Nonnull CriteriaSet criteria, boolean onEmptyPredicatesReturnEmpty) throws ResolverException
Filter the supplied candidates by resolving predicates from the supplied criteria and applying the predicates to return a filteredIterable.- Parameters:
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 candidates- Returns:
- an iterable of the candidates filtered by the resolved predicates
- Throws:
ResolverException- if there is a fatal error during resolution
-
isSatisfyAnyPredicates
public boolean isSatisfyAnyPredicates()
Get the flag indicating whether resolved credentials may satisfy any predicates (i.e. connected by logical 'OR') or all predicates (connected by logical 'AND').Defaults to false.
- Returns:
- true if must satisfy all, false otherwise
-
setSatisfyAnyPredicates
public void setSatisfyAnyPredicates(boolean flag)
Set the flag indicating whether resolved credentials may satisfy any predicates (i.e. connected by logical 'OR') or all predicates (connected by logical 'AND').Defaults to false.
- Parameters:
flag- true if must satisfy all, false otherwise
-
getCriterionPredicateRegistry
@NonnullAfterInit public CriterionPredicateRegistry<MetadataType> getCriterionPredicateRegistry()
Get the registry used in resolving predicates from criteria.- Returns:
- the effective registry instance used
-
setCriterionPredicateRegistry
public void setCriterionPredicateRegistry(@Nullable CriterionPredicateRegistry<MetadataType> registry)Set the registry used in resolving predicates from criteria.- Parameters:
registry- the registry instance to use
-
getCache
@Nonnull protected MetadataCache<MetadataType> getCache()
Get the metadata cache currently in use by the metadata resolver.- Returns:
- the current effective entity backing store
-
isFailFastInitialization
public boolean isFailFastInitialization()
Gets whether problems during initialization should cause the provider to fail or go on without metadata. The assumption being that in most cases a provider will recover at some point in the future.- Returns:
- whether problems during initialization should cause the provider to fail
-
setFailFastInitialization
public void setFailFastInitialization(boolean failFast)
Sets whether problems during initialization should cause the provider to fail or go on without metadata. The assumption being that in most cases a provider will recover at some point in the future.- Parameters:
failFast- whether problems during initialization should cause the provider to fail
-
doInitialize
protected final void doInitialize() throws ComponentInitializationException- Overrides:
doInitializein classAbstractIdentifiedInitializableComponent- Throws:
ComponentInitializationException
-
doDestroy
protected void doDestroy()
- Overrides:
doDestroyin classAbstractInitializableComponent
-
initMetadataResolver
protected abstract void initMetadataResolver() throws ComponentInitializationExceptionInitialise this metadata provider. Subclasses will need to override this method.- Throws:
ComponentInitializationException- if initialization fails.
-
-