Class AbstractAttributeDisplayFunction

java.lang.Object
net.shibboleth.idp.consent.logic.impl.AbstractAttributeDisplayFunction
All Implemented Interfaces:
Function<net.shibboleth.idp.attribute.IdPAttribute,String>
Direct Known Subclasses:
AttributeDisplayDescriptionFunction, AttributeDisplayNameFunction

public abstract class AbstractAttributeDisplayFunction extends Object implements Function<net.shibboleth.idp.attribute.IdPAttribute,String>
Abstract Function which returns Locale-aware information about an attribute. The abstract method getDisplayInfo(AttributeTranscoderRegistry, IdPAttribute) returns the information selected for the attribute from the transcoder. This function defaults to returning the attribute ID if no information is selected from the attribute for the desired locales.
  • Field Details

    • languageRange

      @Nonnull @Unmodifiable private final List<Locale.LanguageRange> languageRange
      The range of locales from the request.
    • defaultLanguageRange

      @Nonnull @Unmodifiable private final List<Locale.LanguageRange> defaultLanguageRange
      The tags for the fallback languages.
    • cachedInfo

      @Nonnull private Map<net.shibboleth.idp.attribute.IdPAttribute,Map<Locale,String>> cachedInfo
      Cache of already looked up values.
    • transcoder

      @Nonnull private ReloadableService<net.shibboleth.idp.attribute.transcoding.AttributeTranscoderRegistry> transcoder
      How to do the lookup.
  • Constructor Details

    • AbstractAttributeDisplayFunction

      public AbstractAttributeDisplayFunction(@Nonnull HttpServletRequest request, @Nullable List<String> defaultLanguages, ReloadableService<net.shibboleth.idp.attribute.transcoding.AttributeTranscoderRegistry> transcoderService)
      Constructor.
      Parameters:
      request - HttpServletRequest used to get preferred languages
      defaultLanguages - list of fallback languages in order of decreasing preference
      transcoderService - the attribute transcoder service
  • Method Details

    • apply

      @Nullable public String apply(@Nullable net.shibboleth.idp.attribute.IdPAttribute input)
      Specified by:
      apply in interface Function<net.shibboleth.idp.attribute.IdPAttribute,String>
    • getDisplayInfo

      @Nonnull protected abstract Map<Locale,String> getDisplayInfo(@Nonnull net.shibboleth.idp.attribute.transcoding.AttributeTranscoderRegistry registry, @Nonnull net.shibboleth.idp.attribute.IdPAttribute attribute)
      Get the information to be displayed from the attribute.
      Parameters:
      registry - the AttributeTranscoderRegistry to ask.
      attribute - the attribute to consider
      Returns:
      the map of locale dependent information to be displayed