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.
Since:
07.04.2021
Author:
Pascal Knueppel
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    validateCreate(T resource, ValidationContext validationContext, Context requestContext)
    validate the resource for valid input before it is reached through to the de.captaingoldfish.scim.sdk.server.endpoints.ResourceHandler#createResource(ResourceNode, Authorization) implementation
    void
    validateUpdate(Supplier<T> oldResourceSupplier, T newResource, ValidationContext validationContext, Context requestContext)
    validate the resource for valid input before it is reached through to the de.captaingoldfish.scim.sdk.server.endpoints.ResourceHandler#updateResource(ResourceNode, Authorization) implementation
  • Method Details

    • validateCreate

      void validateCreate(T resource, ValidationContext validationContext, Context requestContext)
      validate the resource for valid input before it is reached through to the de.captaingoldfish.scim.sdk.server.endpoints.ResourceHandler#createResource(ResourceNode, Authorization) implementation
      Parameters:
      resource - the resource to validate
      validationContext - add as much errors to this context as you like. If at least one error is present the execution will abort with a BadRequestException
      requestContext - 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 the de.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 implementation
      newResource - the new resource representation
      resource - the resource to validate
      validationContext - add as much errors to this context as you like. If at least one error is present the execution will abort with a BadRequestException
      requestContext - the current request context