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

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

        @Nonnull
        private SchemaBuilder schemaBuilder
        The builder 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
                                     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