Package net.shibboleth.metadata.dom.saml
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 Summary
FieldsModifier and TypeFieldDescriptionprivate booleanWhether to include entity attributes.private booleanWhether to include legacy display names if none are found in themdui:UIInfoelement.private booleanWhether to pretty-print the resulting JSON. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate ElementfindFirstUIInfo(List<Element> idpDescriptors) final booleanReturns whether output includes entity attributes.final booleanReturns whether output includes legacy display names.final booleanReturns whether output is being pretty-printed.voidserializeCollection(Collection<Item<Element>> items, OutputStream output) Serializes the collection ofItems to the given output stream.voidsetIncludingEntityAttributes(boolean includeEntityAttributes) Sets whether to include entity attributes.voidsetIncludingLegacyDisplayNames(boolean includeLegacyDisplayNames) Sets whether to include legacy display names.voidsetPrettyPrinting(boolean pretty) Sets whether to pretty-print the output.private voidwriteDisplayNames(JsonGenerator gen, Element entity, Element uiInfo) Write the list of display names to the output.private voidwriteEntityAttributes(JsonGenerator gen, Element entity) Write out an entity's entity attributes.private voidwriteLogos(JsonGenerator gen, Element uiInfo) Write the entity's logos to the output.private voidwriteValueLangList(JsonGenerator gen, List<Element> elements, String key) Write a list of element values and language tags to the output as a JSON array under a given key.private voidwriteValueLangList(JsonGenerator gen, Element uiInfo, QName elementName, String key) Write a value/language list for elements within amdui:UIInfocontainer.Methods inherited from class net.shibboleth.shared.component.AbstractInitializableComponent
checkComponentActive, checkSetterPreconditions, destroy, doDestroy, doInitialize, ifDestroyedThrowDestroyedComponentException, ifInitializedThrowUnmodifiabledComponentException, ifNotInitializedThrowUninitializedComponentException, initialize, isDestroyed, isInitialized
-
Field Details
-
prettyPrinting
private boolean prettyPrintingWhether to pretty-print the resulting JSON. Default:false -
includingLegacyDisplayNames
private boolean includingLegacyDisplayNamesWhether to include legacy display names if none are found in themdui:UIInfoelement. Default:false -
includingEntityAttributes
private boolean includingEntityAttributesWhether 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
- Parameters:
idpDescriptors- list ofmd:IDPSSODescriptors- Returns:
- the first
mdui:UIInfoelement, ornullif 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- theJsonGeneratorto write the output toelements- list ofElements to write outkey- 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 amdui:UIInfocontainer.- Parameters:
gen- theJsonGeneratorto write the output touiInfo- themdui:UIInfoelementelementName- name of the elements to collect fromkey- key for the JSON array within the containing object
-
writeEntityAttributes
Write out an entity's entity attributes.- Parameters:
gen- theJsonGeneratorto write the output toentity- themd:EntityDescriptorelement
-
writeLogos
Write the entity's logos to the output.- Parameters:
gen- theJsonGeneratorto write the output touiInfo- themdui:UIInfoelement
-
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 amdui:UIInfo, we may be able to find some display names there. If we can find nomdui:DisplayNameelements, we instead find legacy display names in themd:Organizationelement.- Parameters:
gen- theJsonGeneratorto write the output toentity-md:EntityDescriptorelementuiInfo-mdui:UIInfoif available, ornull
-
serializeCollection
public void serializeCollection(@Nonnull @NonnullElements Collection<Item<Element>> items, @Nonnull OutputStream output) throws IOException Description copied from interface:ItemCollectionSerializerSerializes the collection ofItems to the given output stream.- Specified by:
serializeCollectionin interfaceItemCollectionSerializer<Element>- Parameters:
items-CollectionofItems to be serializedoutput- output stream to which the serialized form of theItemcollection will be written- Throws:
IOException- if an I/O exception occurs during serialization
-