Class 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 Detail

      • 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.
      • saml20Schemas

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

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

        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.
      • schemaBuilder

        @Nonnull
        private net.shibboleth.utilities.java.support.xml.SchemaBuilder schemaBuilder
        The builder to use.
    • Constructor Detail

      • SAMLSchemaBuilder

        public SAMLSchemaBuilder​(@Nonnull @ParameterName(name="ver")
                                 SAMLSchemaBuilder.SAML1Version ver)
        Constructor.

        A default SchemaBuilder is constructed, and injected with a ClasspathResolver for resolving supplementary schemas.

        Parameters:
        ver - the SAML 1.x version to use
    • Method Detail

      • 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
                                     net.shibboleth.utilities.java.support.xml.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