Class AbstractAttributeDefinition

All Implemented Interfaces:
AttributeDefinition, ResolverPlugin<IdPAttribute>, Component, DestructableComponent, IdentifiableComponent, IdentifiedComponent, InitializableComponent, UnmodifiableComponent, DisposableBean
Direct Known Subclasses:
ContextDerivedAttributeDefinition, DecryptedAttributeDefinition, MappedAttributeDefinition, PrescopedAttributeDefinition, PrincipalNameAttributeDefinition, RegexSplitAttributeDefinition, ResolvedAttributeDefinition, SAML1NameIdentifierAttributeDefinition, SAML2NameIDAttributeDefinition, ScopedAttributeDefinition, ScriptedAttributeDefinition, SimpleAttributeDefinition, StaticAttributeDefinition, TemplateAttributeDefinition

@ThreadSafe
public abstract class AbstractAttributeDefinition
extends AbstractResolverPlugin<IdPAttribute>
implements AttributeDefinition
Base class for attribute definition resolver plugins.
  • Field Details

    • log

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

      private boolean dependencyOnly
      Whether this attribute definition is only a dependency and thus its values should never be released.
    • preRequested

      private boolean preRequested
      Whether this attribute definition is to be pre-resolved.
    • logPrefix

      @Nullable private String logPrefix
      cache for the log prefix - to save multiple recalculations.
  • Constructor Details

    • AbstractAttributeDefinition

      public AbstractAttributeDefinition()
  • Method Details

    • isDependencyOnly

      public boolean isDependencyOnly()
      Gets whether this attribute definition is only a dependency and thus its values should never be released outside the resolver.
      Specified by:
      isDependencyOnly in interface AttributeDefinition
      Returns:
      true if this attribute is only used as a dependency, false otherwise
    • setDependencyOnly

      public void setDependencyOnly​(boolean isDependencyOnly)
      Sets whether this attribute definition is only a dependency and thus its values should never be released outside the resolver.
      Parameters:
      isDependencyOnly - whether this attribute definition is only a dependency
    • isPreRequested

      public boolean isPreRequested()
      Gets whether this attribute definition has to be resolved prior in a first pass (in order to prime contexts which can be used in the "main pass").
      Specified by:
      isPreRequested in interface AttributeDefinition
      Returns:
      true if this is a definition to be done "first"
    • setPreRequested

      public void setPreRequested​(boolean value)
      Sets whether this definition (and its dependencies) are to be pre-resolved.
      Parameters:
      value - what to set
    • doInitialize

      protected void doInitialize() throws ComponentInitializationException
      Overrides:
      doInitialize in class AbstractResolverPlugin<IdPAttribute>
      Throws:
      ComponentInitializationException
    • doResolve

      @Nullable protected IdPAttribute doResolve​(@Nonnull AttributeResolutionContext resolutionContext, @Nonnull AttributeResolverWorkContext workContext) throws ResolutionException
      Perform the actual resolution. The resolved attribute(s) should not be recorded in the work context. This method delegates the actual resolution of the attribute's values to the doAttributeDefinitionResolve(AttributeResolutionContext, AttributeResolverWorkContext) method. Afterwards, if null was not returned, this method will attach the registered display names, descriptions, and encoders to the resultant attribute.
      Specified by:
      doResolve in class AbstractResolverPlugin<IdPAttribute>
      Parameters:
      resolutionContext - current resolution context
      workContext - child context where intermediate results are tracked
      Returns:
      the resolved attributes or null if no attributes were resolved
      Throws:
      ResolutionException - thrown if there is a problem resolving the attributes
      See Also:
      AbstractResolverPlugin.resolve(AttributeResolutionContext)
    • doAttributeDefinitionResolve

      @Nullable protected abstract IdPAttribute doAttributeDefinitionResolve​(@Nonnull AttributeResolutionContext resolutionContext, @Nonnull AttributeResolverWorkContext workContext) throws ResolutionException
      Creates and populates the values for the resolved attribute. Implementations should not set, or otherwise manage, the resolved attribute's display name, description or encoders. Nor should the resultant attribute be recorded in the given resolution context.
      Parameters:
      resolutionContext - current attribute resolution context
      workContext - current resolver work context
      Returns:
      resolved attribute or null if nothing to resolve.
      Throws:
      ResolutionException - thrown if there is a problem resolving and creating the attribute
    • getLogPrefix

      @Nonnull @NotEmpty protected String getLogPrefix()
      return a string which is to be prepended to all log messages.
      Specified by:
      getLogPrefix in class AbstractResolverPlugin<IdPAttribute>
      Returns:
      "Attribute Definition '<definitionID>' :"