Class SAMLSchemaBuilder

java.lang.Object
org.opensaml.saml.common.xml.SAMLSchemaBuilder

@ThreadSafe public class SAMLSchemaBuilder extends Object
A convenience builder for creating Schemas for validating SAML 1.0, 1.1, and 2.0.

Additional schemas may be included in the resulting object by supplying their locations to an injected SchemaBuilder object.

  • Field Details

    • baseXMLSchemas

      @Nonnull @NonnullElements @NotEmpty private static String[] baseXMLSchemas
      Classpath relative location of basic XML schemas.
    • soapSchemas

      @Nonnull @NonnullElements @NotEmpty private static String[] soapSchemas
      Classpath relative location of SOAP 1_1 schemas.
    • saml10Schemas

      @Nonnull @NonnullElements @NotEmpty private static String[] saml10Schemas
      Classpath relative location of SAML 1_0 schemas.
    • saml11Schemas

      @Nonnull @NonnullElements @NotEmpty private static String[] saml11Schemas
      Classpath relative location of SAML 1_1 schemas.
    • saml20CommonSchemas

      @Nonnull @NonnullElements @NotEmpty private static String[] saml20CommonSchemas
      Classpath relative location of the invariant SAML 2.0 schemas.
    • saml20Schemas

      @Nonnull @NonnullElements @NotEmpty private static String[] saml20Schemas
      Classpath relative location of SAML 2_0 schemas.
    • saml20StrictSchemas

      @Nonnull @NonnullElements @NotEmpty private static String[] saml20StrictSchemas
      Classpath relative location of SAML 2_0 schemas with strict string/anyURI types.
    • baseExtSchemas

      @Nonnull @NonnullElements @NotEmpty private static String[] baseExtSchemas
      Classpath relative location of SAML extension schemas.
    • log

      @Nonnull private org.slf4j.Logger log
      Logger.
    • unresolvedSchemaFatal

      private boolean unresolvedSchemaFatal
      Flag indicating whether the failure to resolve a schema resource should be considered fatal.
    • cachedSchema

      @Nullable private Schema cachedSchema
      Cached copy of the schema produced by the builder.
    • saml1xSchemas

      @Nonnull @NonnullElements @NotEmpty private String[] saml1xSchemas
      Reference to SAML 1.x schemas to apply.
    • saml2Schemas

      @Nonnull @NonnullElements @NotEmpty private String[] saml2Schemas
      Reference to SAML 2.0 schemas to apply.
    • schemaBuilder

      @Nonnull private SchemaBuilder schemaBuilder
      The builder to use.
  • Constructor Details

  • Method Details

    • setUnresolvedSchemaFatal

      public void setUnresolvedSchemaFatal(boolean flag)
      Set the flag indicating whether the failure to resolve a schema resource should be considered fatal.

      Default value: true.

      Parameters:
      flag - true if should be fatal, false if not
    • setSchemaBuilder

      public void setSchemaBuilder(@Nonnull SchemaBuilder builder)
      Set a custom SchemaBuilder to use.
      Parameters:
      builder - SchemaBuilder to use
    • getSAMLSchema

      @Nonnull public Schema getSAMLSchema() throws SAXException
      Get a schema that can validate SAML 1.x, 2.0, and all registered extensions.
      Returns:
      schema
      Throws:
      SAXException - thrown if a schema object cannot be created
    • configureBuilder

      @Nonnull private void configureBuilder()
      Configure the appropriate SchemaBuilder with the right set of schemas.
    • addSchemaToBuilder

      private void addSchemaToBuilder(@Nonnull String source)
      Load the schema from the specified source and add it to the internal SchemaBuilder.
      Parameters:
      source - the schema resource path