Class AbstractOIDCMetadataResolver<MetadataIdentifier,MetadataType>

Type Parameters:
MetadataIdentifier - the type used to identify the metadata
MetadataType - 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 Details

    • log

      @Nonnull private final org.slf4j.Logger log
      Class logger.
    • logPrefix

      @Nullable 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 Details

    • AbstractOIDCMetadataResolver

      protected AbstractOIDCMetadataResolver(@Nonnull MetadataCache<MetadataType> metadataCache)
      Constructor.
      Parameters:
      metadataCache - the metadata cache to use.
  • Method Details

    • 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(@Nullable CriteriaSet criteria) throws ResolverException
      Specified by:
      resolveSingle in interface Resolver<MetadataIdentifier,MetadataType>
      Throws:
      ResolverException
    • resolve

      @Nonnull public Iterable<MetadataType> resolve(@Nullable CriteriaSet criteria) throws ResolverException
      Specified by:
      resolve in interface Resolver<MetadataIdentifier,MetadataType>
      Throws:
      ResolverException
    • predicateFilterCandidates

      @Nonnull protected Iterable<MetadataType> predicateFilterCandidates(@Nonnull Iterable<MetadataType> candidates, @Nullable CriteriaSet criteria, boolean onEmptyPredicatesReturnEmpty) throws ResolverException
      Filter the supplied candidates by resolving predicates from the supplied criteria and applying the predicates to return a filtered Iterable.
      Parameters:
      candidates - the candidates to evaluate
      criteria - the criteria set to evaluate
      onEmptyPredicatesReturnEmpty - 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:
      doInitialize in class AbstractIdentifiedInitializableComponent
      Throws:
      ComponentInitializationException
    • doDestroy

      protected void doDestroy()
      Overrides:
      doDestroy in class AbstractInitializableComponent
    • initMetadataResolver

      protected abstract void initMetadataResolver() throws ComponentInitializationException
      Initialise this metadata provider. Subclasses will need to override this method.
      Throws:
      ComponentInitializationException - if initialization fails.