Class AbstractSchemaValidator
- java.lang.Object
-
- de.captaingoldfish.scim.sdk.server.schemas.validation.AbstractSchemaValidator
-
- Direct Known Subclasses:
MetaSchemaValidator,RequestSchemaValidator,ResponseSchemaValidator
public abstract class AbstractSchemaValidator extends Object
- Since:
- 23.04.2021
- Author:
- Pascal Knueppel
-
-
Field Summary
Fields Modifier and Type Field Description protected ClassresourceNodeType
-
Constructor Summary
Constructors Constructor Description AbstractSchemaValidator(ServiceProvider serviceProvider, Class resourceNodeType)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected com.fasterxml.jackson.databind.JsonNodecheckDocumentAndMetaSchemaRelationship(Schema resourceSchema, com.fasterxml.jackson.databind.JsonNode document)this method will verify that the meta schema is the correct schema to validate the document.AttributeExtractorgetAttributeExtractor(com.fasterxml.jackson.databind.JsonNode resource)retrieves the attribute extractor that should be used based on the service providers configurationprotected abstract Optional<com.fasterxml.jackson.databind.JsonNode>validateAttribute(SchemaAttribute schemaAttribute, com.fasterxml.jackson.databind.JsonNode attribute)the concrete attribute validation that is differs by the context in which the attribute is validatedprotected ScimObjectNodevalidateDocument(ScimObjectNode validatedResource, Schema resourceSchema, com.fasterxml.jackson.databind.JsonNode resource)this method will validates either a resource document or an extension document that is part of the resource document.ScimObjectNodevalidateDocument(Schema schema, com.fasterxml.jackson.databind.JsonNode resource)checks the given document against the schema definition of the#resourceType
-
-
-
Field Detail
-
resourceNodeType
protected final Class resourceNodeType
-
-
Constructor Detail
-
AbstractSchemaValidator
public AbstractSchemaValidator(ServiceProvider serviceProvider, Class resourceNodeType)
-
-
Method Detail
-
validateAttribute
protected abstract Optional<com.fasterxml.jackson.databind.JsonNode> validateAttribute(SchemaAttribute schemaAttribute, com.fasterxml.jackson.databind.JsonNode attribute)
the concrete attribute validation that is differs by the context in which the attribute is validated- Parameters:
schemaAttribute- the definition of the attribute that must be validatedattribute- the attribute to validate- Returns:
- the validated attribute
-
validateDocument
public ScimObjectNode validateDocument(Schema schema, com.fasterxml.jackson.databind.JsonNode resource)
checks the given document against the schema definition of the#resourceType- Parameters:
resource- the document that should be validated- Returns:
- the validated resource
-
checkDocumentAndMetaSchemaRelationship
protected com.fasterxml.jackson.databind.JsonNode checkDocumentAndMetaSchemaRelationship(Schema resourceSchema, com.fasterxml.jackson.databind.JsonNode document)
this method will verify that the meta schema is the correct schema to validate the document. This is done by comparing the "id"-attribute of the metaSchema with the "schemas"-attribute of the document- Parameters:
resourceSchema- the resources schema that should be used to validate the documentdocument- the document that should be validated
-
validateDocument
protected ScimObjectNode validateDocument(ScimObjectNode validatedResource, Schema resourceSchema, com.fasterxml.jackson.databind.JsonNode resource)
this method will validates either a resource document or an extension document that is part of the resource document. Extensions are handled as individual schemas.- Parameters:
validatedResource- The object into which the validated attributes will be added. In case of main document validation this object will be of typeResourceNodeand in case of extension validation of typeScimObjectNoderesourceSchema- the definition of the document that is either the main schema of the#resourceTypeof an extension that is present within the current documentresource- the document that should be validated- Returns:
- the validated document with its scim attribute representations
-
getAttributeExtractor
public AttributeExtractor getAttributeExtractor(com.fasterxml.jackson.databind.JsonNode resource)
retrieves the attribute extractor that should be used based on the service providers configuration- Parameters:
resource- the resource that acts as the attribute extractors base document- Returns:
- the attribute extractor to use. Default is the case-sensitive attribute extractor
-
-