Class MetadataGeneratorImpl

java.lang.Object
net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
net.shibboleth.idp.installer.metadata.impl.MetadataGeneratorImpl
All Implemented Interfaces:
MetadataGenerator, Component, DestructableComponent, InitializableComponent

public class MetadataGeneratorImpl extends AbstractInitializableComponent implements MetadataGenerator
This class gathers information which it then uses to generate IdP Metadata. Loosely based on the SP metadata generator, and the V2 metadata.
  • Field Details

  • Constructor Details

    • MetadataGeneratorImpl

      public MetadataGeneratorImpl()
  • Method Details

    • doInitialize

      protected void doInitialize() throws ComponentInitializationException
      Overrides:
      doInitialize in class AbstractInitializableComponent
      Throws:
      ComponentInitializationException
    • setOutput

      public void setOutput(@Nonnull File file)
      Set where to write the metadata.
      Specified by:
      setOutput in interface MetadataGenerator
      Parameters:
      file - what to set.
    • setParameters

      public void setParameters(@Nonnull MetadataGeneratorParameters what)
      Set a description of the IdP.
      Specified by:
      setParameters in interface MetadataGenerator
      Parameters:
      what - what to set. This component does not have to be initialized.
    • removeBackChannel

      public void removeBackChannel()
      remove back channel endpoints.
    • getEndpoints

      public EnumSet<MetadataGeneratorImpl.Endpoints> getEndpoints()
      Get the Endpoints.
      Returns:
      Returns the Endpoints
    • setEndpoints

      public void setEndpoints(@Nonnull EnumSet<MetadataGeneratorImpl.Endpoints> points)
      Set the Endpoints.
      Parameters:
      points - what to set.
    • isSAML2AttributeQueryCommented

      public boolean isSAML2AttributeQueryCommented()
      Returns whether to comment the SAML2 AA endpoint.
      Returns:
      whether to comment the SAML2 AA endpoint
    • setSAML2AttributeQueryCommented

      public void setSAML2AttributeQueryCommented(boolean asComment)
      Sets whether to comment the SAML2 AA endpoint.
      Parameters:
      asComment - whether to comment or not.
    • isSAML1Commented

      public boolean isSAML1Commented()
      Returns whether to comment SAML1 endpoints.
      Returns:
      whether to comment SAML1 endpoints
    • setSAML1Commented

      public void setSAML1Commented(boolean asComment)
      Sets whether to comment the comment SAML1 endpoints.
      Parameters:
      asComment - whether to comment or not.
    • isSAML2LogoutCommented

      public boolean isSAML2LogoutCommented()
      Returns whether to comment the SAML2 Logout endpoints.
      Returns:
      whether to comment the SAML2 Logout endpoints
    • setSAML2LogoutCommented

      public void setSAML2LogoutCommented(boolean asComment)
      Sets whether to comment the SAML2 Logout endpoints.
      Parameters:
      asComment - whether to comment or not
    • generate

      public void generate() throws org.apache.tools.ant.BuildException
      Generate the metadata given the parameters.
      Specified by:
      generate in interface MetadataGenerator
      Throws:
      org.apache.tools.ant.BuildException - if badness occurs.
    • writeComments

      protected void writeComments() throws IOException
      Add appropriate comments to metadata header.
      Throws:
      IOException - if badness occurs in the writer
    • writeNameSpace

      protected void writeNameSpace(@Nullable String prefix, @Nonnull String name) throws IOException
      Writeout a prefix/namespace pair.
      Parameters:
      prefix - the prefix, or null
      name - the namespace
      Throws:
      IOException - if badness happens
    • writeIDPSSO

      protected void writeIDPSSO() throws IOException
      Write the <IDPSSODescriptor>.
      Throws:
      IOException - if badness happens
    • writeAttributeAuthorityDescriptor

      private void writeAttributeAuthorityDescriptor() throws IOException
      Write the <AttributeAuthorityDescriptor>.
      Throws:
      IOException - if badness happens
    • writeRoleDescriptor

      protected void writeRoleDescriptor(String name, List<String> protocols) throws IOException
      Write out an role descriptor.
      Parameters:
      name - the name
      protocols - the supported protocols
      Throws:
      IOException - when badness happebns
    • openExtensions

      protected void openExtensions() throws IOException
      Write the open <Extensions> elements.
      Throws:
      IOException - if badness happens
    • closeExtensions

      protected void closeExtensions() throws IOException
      Write out the close <\Extensions> Element.
      Throws:
      IOException - if badness happens
    • writeScope

      protected void writeScope() throws IOException
      Write out the <shibmd:Scope> element.
      Throws:
      IOException - if badness happens
    • writeMDUI

      protected void writeMDUI() throws IOException
      Write out the <mdui:UIINFO> element and children.
      Throws:
      IOException - if badness happens
    • writeLangAttribute

      protected void writeLangAttribute(String language) throws IOException
      Write the language attribute.
      Parameters:
      language - which languages
      Throws:
      IOException - if badness happens
    • writeKeyDescriptors

      protected void writeKeyDescriptors() throws IOException
      Write out any <KeyDescriptor>Elements.
      Throws:
      IOException - if badness happens
    • writeKeyDescriptors

      protected void writeKeyDescriptors(@Nullable List<List<String>> certs, @Nonnull @NotEmpty String use) throws IOException
      Write out <KeyDescriptor>Elements. of a specific type
      Parameters:
      certs - the certificates
      use - the type - signing or encryption
      Throws:
      IOException - if badness happens
    • outputEndpoint

      protected void outputEndpoint(MetadataGeneratorImpl.Endpoints endpoint) throws IOException
      Output the SAML for a single endpoint.
      Parameters:
      endpoint - the type
      Throws:
      IOException - if badness happens.
    • writeNameSpaceQualified

      protected void writeNameSpaceQualified(@Nonnull String nameSpace, String what) throws IOException
      Write a namespace:identifier pair.
      Parameters:
      nameSpace - the namespace
      what - the identifier
      Throws:
      IOException - if badness happens
    • openComment

      private void openComment() throws IOException
      Add an open comment. If we are nested closes the previous one.
      Throws:
      IOException - if badness happens
    • closeComment

      private void closeComment() throws IOException
      Add a close comment. If we are nested reopens the previous one.
      Throws:
      IOException - if badness happens