Interface RequestValidator<T extends ResourceNode>
public interface RequestValidator<T extends ResourceNode>
This validator can be used to validate incoming requests for specific endpoints. In some cases it might be
useful to validate the given input and check if a resource is allowed to be created with the given input.
The schema validation is not enough in some cases and therefore this implementation can be used to validate
specific parts and return an error before the actual endpoint is reached.
This feature shall be an imitation of the java enterprise custom bean validation when custom bean validation implementations are used.
This feature shall be an imitation of the java enterprise custom bean validation when custom bean validation implementations are used.
- Since:
- 07.04.2021
- Author:
- Pascal Knueppel
-
Method Summary
Modifier and TypeMethodDescriptionvoidvalidateCreate(T resource, ValidationContext validationContext, Context requestContext) validate the resource for valid input before it is reached through to thede.captaingoldfish.scim.sdk.server.endpoints.ResourceHandler#createResource(ResourceNode, Authorization)implementationvoidvalidateUpdate(Supplier<T> oldResourceSupplier, T newResource, ValidationContext validationContext, Context requestContext) validate the resource for valid input before it is reached through to thede.captaingoldfish.scim.sdk.server.endpoints.ResourceHandler#updateResource(ResourceNode, Authorization)implementation
-
Method Details
-
validateCreate
validate the resource for valid input before it is reached through to thede.captaingoldfish.scim.sdk.server.endpoints.ResourceHandler#createResource(ResourceNode, Authorization)implementation- Parameters:
resource- the resource to validatevalidationContext- add as much errors to this context as you like. If at least one error is present the execution will abort with aBadRequestExceptionrequestContext- the current request context
-
validateUpdate
void validateUpdate(Supplier<T> oldResourceSupplier, T newResource, ValidationContext validationContext, Context requestContext) validate the resource for valid input before it is reached through to thede.captaingoldfish.scim.sdk.server.endpoints.ResourceHandler#updateResource(ResourceNode, Authorization)implementation- Parameters:
oldResourceSupplier- extracts the old resource representation by calling the SCIM get-endpoint when not already done by the ETag implementationnewResource- the new resource representationresource- the resource to validatevalidationContext- add as much errors to this context as you like. If at least one error is present the execution will abort with aBadRequestExceptionrequestContext- the current request context
-