Class EntityDescriptorBuilder

java.lang.Object
se.swedenconnect.opensaml.common.builder.AbstractSAMLObjectBuilder<org.opensaml.saml.saml2.metadata.EntityDescriptor>
se.swedenconnect.opensaml.saml2.metadata.build.EntityDescriptorBuilder
All Implemented Interfaces:
SAMLObjectBuilder<org.opensaml.saml.saml2.metadata.EntityDescriptor>

public class EntityDescriptorBuilder extends AbstractSAMLObjectBuilder<org.opensaml.saml.saml2.metadata.EntityDescriptor>
A builder for creating EntityDescriptor objects.
Author:
Martin Lindström (martin@idsec.se)
  • Constructor Details

    • EntityDescriptorBuilder

      public EntityDescriptorBuilder()
      Constructor setting up the builder with no template. This means that the entire EntityDescriptor object is created from data assigned using the builder.
    • EntityDescriptorBuilder

      public EntityDescriptorBuilder(InputStream resource) throws net.shibboleth.shared.xml.XMLParserException, org.opensaml.core.xml.io.UnmarshallingException, IOException
      Constructor setting up the builder with a template EntityDescriptor that is read from a resource. Users of the bean may now change, add or delete, the elements and attributes of the template object using the assignment methods of the builder.
      Parameters:
      resource - the template resource
      Throws:
      IOException - if the resource can not be read
      org.opensaml.core.xml.io.UnmarshallingException - for unmarshalling errors
      net.shibboleth.shared.xml.XMLParserException - for XML parsing errors
    • EntityDescriptorBuilder

      public EntityDescriptorBuilder(org.opensaml.saml.saml2.metadata.EntityDescriptor template)
      Parameters:
      template - the template
    • EntityDescriptorBuilder

      public EntityDescriptorBuilder(org.opensaml.saml.saml2.metadata.EntityDescriptor template, boolean clone)
      Constructor setting up the builder with a template EntityDescriptor. Users of the bean may now change, add or delete, the elements and attributes of the template object using the assignment methods of the builder.
      Parameters:
      template - the template
      clone - whether the template object should be cloned
  • Method Details

    • entityID

      public EntityDescriptorBuilder entityID(String entityID)
      Assigns the entityID for the EntityDescriptor.
      Parameters:
      entityID - the entityID
      Returns:
      the builder
    • builder

      public static EntityDescriptorBuilder builder()
      Utility method that creates an EntityDescriptorBuilder instance.
      Returns:
      an EntityDescriptorBuilder instance
    • builder

      public static EntityDescriptorBuilder builder(InputStream resource) throws net.shibboleth.shared.xml.XMLParserException, org.opensaml.core.xml.io.UnmarshallingException, IOException
      Utility method that creates an EntityDescriptorBuilder instance from a supplied input stream.
      Parameters:
      resource - the template resource
      Returns:
      an EntityDescriptorBuilder instance
      Throws:
      IOException - if the resource can not be read
      org.opensaml.core.xml.io.UnmarshallingException - for unmarshalling errors
      net.shibboleth.shared.xml.XMLParserException - for XML parsing errors
    • builder

      public static EntityDescriptorBuilder builder(org.opensaml.saml.saml2.metadata.EntityDescriptor template)
      Utility method that creates an EntityDescriptorBuilder instance from a supplied template.
      Parameters:
      template - the template
      Returns:
      an EntityDescriptorBuilder instance
    • builder

      public static EntityDescriptorBuilder builder(org.opensaml.saml.saml2.metadata.EntityDescriptor template, boolean clone)
      Utility method that creates an EntityDescriptorBuilder instance from a supplied template.
      Parameters:
      template - the template
      clone - whether the template object should be cloned
      Returns:
      an EntityDescriptorBuilder instance
    • id

      Assigns the ID attribute for the EntityDescriptor.
      Parameters:
      id - the ID
      Returns:
      the builder
    • cacheDuration

      public EntityDescriptorBuilder cacheDuration(Long cacheDuration)
      Assigns the cacheDuration attribute for the EntityDescriptor.
      Parameters:
      cacheDuration - the cache duration (in milliseconds)
      Returns:
      the builder
    • cacheDuration

      public EntityDescriptorBuilder cacheDuration(Duration cacheDuration)
      Assigns the cacheDuration attribute for the EntityDescriptor.
      Parameters:
      cacheDuration - the cache duration
      Returns:
      the builder
    • validUntil

      public EntityDescriptorBuilder validUntil(Instant time)
      Assigns the valid until time.
      Parameters:
      time - valid until
      Returns:
      the builder
    • extensions

      public EntityDescriptorBuilder extensions(org.opensaml.saml.saml2.metadata.Extensions extensions)
      Assigns metadata extensions.
      Parameters:
      extensions - the metadata extensions.
      Returns:
      the builder
    • getExtensionsBuilder

      public ExtensionsBuilder getExtensionsBuilder()
      Based on the contents of this object, an ExtensionsBuilder is returned. If the object holds an Extensions object, this is fed to the builder (but not cloned).
      Returns:
      an ExtensionsBuilder
    • roleDescriptors

      public EntityDescriptorBuilder roleDescriptors(List<org.opensaml.saml.saml2.metadata.RoleDescriptor> roleDescriptors)
      Adds the supplied SSO descriptors.
      Parameters:
      roleDescriptors - the SSO descriptors to add
      Returns:
      the builder
    • roleDescriptors

      public EntityDescriptorBuilder roleDescriptors(org.opensaml.saml.saml2.metadata.RoleDescriptor... roleDescriptors)
      Parameters:
      roleDescriptors - the SSO descriptors to add
      Returns:
      the builder
    • ssoDescriptor

      public EntityDescriptorBuilder ssoDescriptor(org.opensaml.saml.saml2.metadata.SSODescriptor ssoDescriptor)
      Adds one SSO descriptor (which is the most common case).
      Parameters:
      ssoDescriptor - the descriptor to add
      Returns:
      the builder
    • organization

      public EntityDescriptorBuilder organization(org.opensaml.saml.saml2.metadata.Organization organization)
      Assigns the Organization element to the entity descriptor.
      Parameters:
      organization - the organization (will be cloned before assignment)
      Returns:
      the builder
    • contactPersons

      public EntityDescriptorBuilder contactPersons(List<org.opensaml.saml.saml2.metadata.ContactPerson> contactPersons)
      Assigns the ContactPerson elements to the entity descriptor.
      Parameters:
      contactPersons - the contact person elements (will be cloned before assignment)
      Returns:
      the builder
    • contactPersons

      public EntityDescriptorBuilder contactPersons(org.opensaml.saml.saml2.metadata.ContactPerson... contactPersons)
      Parameters:
      contactPersons - the contact person elements (will be cloned before assignment)
      Returns:
      the builder
      See Also:
    • getObjectType

      protected Class<org.opensaml.saml.saml2.metadata.EntityDescriptor> getObjectType()
      Returns the object type.
      Specified by:
      getObjectType in class AbstractSAMLObjectBuilder<org.opensaml.saml.saml2.metadata.EntityDescriptor>
      Returns:
      the object type