Class DiscoFeedCollectionSerializer

java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
net.shibboleth.metadata.dom.saml.DiscoFeedCollectionSerializer
All Implemented Interfaces:
ItemCollectionSerializer<Element>, net.shibboleth.shared.component.Component, net.shibboleth.shared.component.DestructableComponent, net.shibboleth.shared.component.InitializableComponent

public class DiscoFeedCollectionSerializer extends net.shibboleth.shared.component.AbstractInitializableComponent implements ItemCollectionSerializer<Element>
A collection serializer that generates an equivalent of the Shibboleth SP's discovery feed output from a collection of entity descriptors.
Since:
0.10.0
  • Field Details

    • prettyPrinting

      private boolean prettyPrinting
      Whether to pretty-print the resulting JSON. Default: false
    • includingLegacyDisplayNames

      private boolean includingLegacyDisplayNames
      Whether to include legacy display names if none are found in the mdui:UIInfo element. Default: false
    • includingEntityAttributes

      private boolean includingEntityAttributes
      Whether to include entity attributes. Default: false
  • Constructor Details

    • DiscoFeedCollectionSerializer

      public DiscoFeedCollectionSerializer()
  • Method Details

    • isPrettyPrinting

      public final boolean isPrettyPrinting()
      Returns whether output is being pretty-printed.
      Returns:
      whether output is being pretty-printed
    • setPrettyPrinting

      public void setPrettyPrinting(boolean pretty)
      Sets whether to pretty-print the output.
      Parameters:
      pretty - whether to pretty-print the output
    • isIncludingLegacyDisplayNames

      public final boolean isIncludingLegacyDisplayNames()
      Returns whether output includes legacy display names.
      Returns:
      whether output includes legacy display names
    • setIncludingLegacyDisplayNames

      public void setIncludingLegacyDisplayNames(boolean includeLegacyDisplayNames)
      Sets whether to include legacy display names.
      Parameters:
      includeLegacyDisplayNames - whether to include legacy display names
    • isIncludingEntityAttributes

      public final boolean isIncludingEntityAttributes()
      Returns whether output includes entity attributes.
      Returns:
      whether output includes entity attributes
    • setIncludingEntityAttributes

      public void setIncludingEntityAttributes(boolean includeEntityAttributes)
      Sets whether to include entity attributes.
      Parameters:
      includeEntityAttributes - whether to include entity attributes.
    • findFirstUIInfo

      @Nullable private Element findFirstUIInfo(@Nonnull @NonnullElements List<Element> idpDescriptors)
      Find the first mdui:UIInfo Element across a list of md:IDPSSODescriptors.
      Parameters:
      idpDescriptors - list of md:IDPSSODescriptors
      Returns:
      the first mdui:UIInfo element, or null if none are found
    • writeValueLangList

      private void writeValueLangList(@Nonnull JsonGenerator gen, @Nonnull @NonnullElements List<Element> elements, @Nonnull String key)
      Write a list of element values and language tags to the output as a JSON array under a given key.
      Parameters:
      gen - the JsonGenerator to write the output to
      elements - list of Elements to write out
      key - key for the JSON array within the containing object
    • writeValueLangList

      private void writeValueLangList(@Nonnull JsonGenerator gen, @Nonnull Element uiInfo, @Nonnull QName elementName, @Nonnull String key)
      Write a value/language list for elements within a mdui:UIInfo container.
      Parameters:
      gen - the JsonGenerator to write the output to
      uiInfo - the mdui:UIInfo element
      elementName - name of the elements to collect from
      key - key for the JSON array within the containing object
    • writeEntityAttributes

      private void writeEntityAttributes(@Nonnull JsonGenerator gen, @Nonnull Element entity)
      Write out an entity's entity attributes.
      Parameters:
      gen - the JsonGenerator to write the output to
      entity - the md:EntityDescriptor element
    • writeLogos

      private void writeLogos(@Nonnull JsonGenerator gen, @Nonnull Element uiInfo)
      Write the entity's logos to the output.
      Parameters:
      gen - the JsonGenerator to write the output to
      uiInfo - the mdui:UIInfo element
    • writeDisplayNames

      private void writeDisplayNames(@Nonnull JsonGenerator gen, @Nonnull Element entity, @Nullable Element uiInfo)
      Write the list of display names to the output. If we have a mdui:UIInfo, we may be able to find some display names there. If we can find no mdui:DisplayName elements, we instead find legacy display names in the md:Organization element.
      Parameters:
      gen - the JsonGenerator to write the output to
      entity - md:EntityDescriptor element
      uiInfo - mdui:UIInfo if available, or null
    • serializeCollection

      public void serializeCollection(@Nonnull @NonnullElements Collection<Item<Element>> items, @Nonnull OutputStream output) throws IOException
      Description copied from interface: ItemCollectionSerializer
      Serializes the collection of Items to the given output stream.
      Specified by:
      serializeCollection in interface ItemCollectionSerializer<Element>
      Parameters:
      items - Collection of Items to be serialized
      output - output stream to which the serialized form of the Item collection will be written
      Throws:
      IOException - if an I/O exception occurs during serialization