Package org.opensaml.saml.common.xml
Class SAMLSchemaBuilder
- java.lang.Object
-
- org.opensaml.saml.common.xml.SAMLSchemaBuilder
-
@ThreadSafe public class SAMLSchemaBuilder extends Object
A convenience builder for creatingSchemas 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
SchemaBuilderobject.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSAMLSchemaBuilder.SAML1VersionIdentifies which SAML 1.x version is in use.
-
Field Summary
Fields Modifier and Type Field Description private static String[]baseExtSchemasClasspath relative location of SAML extension schemas.private static String[]baseXMLSchemasClasspath relative location of basic XML schemas.private SchemacachedSchemaCached copy of the schema produced by the builder.private org.slf4j.LoggerlogLogger.private static String[]saml10SchemasClasspath relative location of SAML 1_0 schemas.private static String[]saml11SchemasClasspath relative location of SAML 1_1 schemas.private String[]saml1xSchemasReference to SAML 1.x schemas to apply.private static String[]saml20CommonSchemasClasspath relative location of the invariant SAML 2.0 schemas.private static String[]saml20SchemasClasspath relative location of SAML 2_0 schemas.private static String[]saml20StrictSchemasClasspath relative location of SAML 2_0 schemas with strict string/anyURI types.private String[]saml2SchemasReference to SAML 2.0 schemas to apply.private SchemaBuilderschemaBuilderThe builder to use.private static String[]soapSchemasClasspath relative location of SOAP 1_1 schemas.private booleanunresolvedSchemaFatalFlag indicating whether the failure to resolve a schema resource should be considered fatal.
-
Constructor Summary
Constructors Constructor Description SAMLSchemaBuilder(SAMLSchemaBuilder.SAML1Version ver)Constructor.SAMLSchemaBuilder(SAMLSchemaBuilder.SAML1Version ver, boolean strict)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidaddSchemaToBuilder(String source)Load the schema from the specified source and add it to the internalSchemaBuilder.private voidconfigureBuilder()Configure the appropriateSchemaBuilderwith the right set of schemas.SchemagetSAMLSchema()Get a schema that can validate SAML 1.x, 2.0, and all registered extensions.voidsetSchemaBuilder(SchemaBuilder builder)Set a customSchemaBuilderto use.voidsetUnresolvedSchemaFatal(boolean flag)Set the flag indicating whether the failure to resolve a schema resource should be considered fatal.
-
-
-
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.
-
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 Detail
-
SAMLSchemaBuilder
public SAMLSchemaBuilder(@Nonnull @ParameterName(name="ver") SAMLSchemaBuilder.SAML1Version ver)
Constructor.A default
SchemaBuilderis constructed, and injected with aClasspathResolverfor resolving supplementary schemas.- Parameters:
ver- the SAML 1.x version to use
-
SAMLSchemaBuilder
public SAMLSchemaBuilder(@Nonnull @ParameterName(name="ver") SAMLSchemaBuilder.SAML1Version ver, @ParameterName(name="strict") boolean strict)
Constructor.A default
SchemaBuilderis constructed, and injected with aClasspathResolverfor resolving supplementary schemas.- Parameters:
ver- the SAML 1.x version to usestrict- whether to apply modified schemas with strict string and anyURI type definitions- Since:
- 4.1.0
-
-
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 customSchemaBuilderto 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 appropriateSchemaBuilderwith the right set of schemas.
-
addSchemaToBuilder
private void addSchemaToBuilder(@Nonnull String source)Load the schema from the specified source and add it to the internalSchemaBuilder.- Parameters:
source- the schema resource path
-
-