Class SubjectDataConnector

All Implemented Interfaces:
DataConnector, ResolverPlugin<Map<String,IdPAttribute>>, Component, DestructableComponent, IdentifiableComponent, IdentifiedComponent, InitializableComponent, UnmodifiableComponent, DisposableBean

@ThreadSafe public class SubjectDataConnector extends AbstractDataConnector
A DataConnector that extracts all IdPAttributePrincipal objects from the Subject objects associated with the request.
Since:
4.0.0
  • Field Details

    • log

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

      private boolean forCanonicalization
      Flag denoting whether plugin is being used for subject c14n or standard usage.
    • scLookupStrategy

      @Nonnull private Function<ProfileRequestContext,SubjectContext> scLookupStrategy
      Strategy used to locate the SubjectContext to use.
    • subjectLookupStrategy

      @Nullable private Function<ProfileRequestContext,Subject> subjectLookupStrategy
      Strategy used to locate the Subject to use.
    • noResultIsError

      private boolean noResultIsError
      Controls handling of empty results.
  • Constructor Details

    • SubjectDataConnector

      public SubjectDataConnector()
      Constructor.
  • Method Details

    • isForCanonicalization

      public boolean isForCanonicalization()
      Gets whether the connector is being used during Subject Canonicalization, causing auto-installation of an alternate Subject lookup strategy.
      Returns:
      whether connector is being used during c14n
    • setForCanonicalization

      public void setForCanonicalization(boolean flag)
      Sets whether the connector is being used during Subject Canonicalization, causing auto-installation of an alternate Subject lookup strategy.

      Defaults to false.

      Parameters:
      flag - flag to set
    • setSubjectContextLookupStrategy

      public void setSubjectContextLookupStrategy(@Nonnull Function<ProfileRequestContext,SubjectContext> strategy)
      Sets the strategy used to locate the SubjectContext associated with a given AttributeResolutionContext.
      Parameters:
      strategy - lookup strategy
    • setSubjectLookupStrategy

      public void setSubjectLookupStrategy(@Nullable Function<ProfileRequestContext,Subject> strategy)
      Sets the strategy used to locate a Subject associated with a given AttributeResolutionContext.
      Parameters:
      strategy - strategy used to locate a Subject associated with a given AttributeResolutionContext
    • isNoResultIsError

      public boolean isNoResultIsError()
      Gets whether obtaining no results should be treated as an error.
      Returns:
      whether obtaining no results should be treated as an error
    • setNoResultIsError

      public void setNoResultIsError(boolean flag)
      Sets whether obtaining no results should be treated as an error.

      Defaults to false.

      Parameters:
      flag - flag to set
    • doInitialize

      protected void doInitialize() throws ComponentInitializationException
      Overrides:
      doInitialize in class AbstractDataConnector
      Throws:
      ComponentInitializationException
    • doDataConnectorResolve

      @Nonnull protected Map<String,IdPAttribute> doDataConnectorResolve(@Nonnull AttributeResolutionContext resolutionContext, @Nonnull AttributeResolverWorkContext workContext) throws ResolutionException
      Retrieves a collection of attributes from some data source.
      Specified by:
      doDataConnectorResolve in class AbstractDataConnector
      Parameters:
      resolutionContext - current resolution context
      workContext - current resolver work context
      Returns:
      collected attributes indexed by attribute ID
      Throws:
      ResolutionException - thrown if there is a problem resolving the attributes