Class MaxLengthValidatorImpl

java.lang.Object
de.hybris.platform.sap.productconfig.frontend.validator.impl.MaxLengthValidatorImpl
All Implemented Interfaces:
CsticValueValidator

public class MaxLengthValidatorImpl extends Object implements CsticValueValidator
Enforeces that a cstic value does not exceed the maximum length.
This is also checked on the UI, for example by setting the maxLength attribute of the corresponding input field. However we can not no trust the UI. An attacker might manipulate the request and/or the UI to inject malicious code by sending much longer values. Enforcing the maxLength of the value, makes it much more difficult for an Atttacker to inject malicious code.
  • Constructor Details

    • MaxLengthValidatorImpl

      public MaxLengthValidatorImpl()
  • Method Details

    • getMaxLengthFallback

      protected int getMaxLengthFallback()
    • validate

      public String validate(CsticData cstic, org.springframework.validation.Errors errorObj, String value)
      Description copied from interface: CsticValueValidator
      Validates the value of the cstic.
      Specified by:
      validate in interface CsticValueValidator
      Parameters:
      cstic - to access any meta data for validation
      errorObj - to add errors if found
      value - actual value to check
      Returns:
      modified value, or null if no value modification is required
    • getMaxLength

      protected int getMaxLength(CsticData cstic)
    • appliesTo

      public boolean appliesTo(CsticData cstic)
      Specified by:
      appliesTo in interface CsticValueValidator
      Returns:
      true only if this validator is apllicable to this cstic
    • appliesToValues

      public boolean appliesToValues()
      Specified by:
      appliesToValues in interface CsticValueValidator
      Returns:
      true only if this validator is apllicable to this cstic values
    • appliesToFormattedValues

      public boolean appliesToFormattedValues()
      Specified by:
      appliesToFormattedValues in interface CsticValueValidator
      Returns:
      true only if this validator is apllicable to formatted cstic values
    • appliesToAdditionalValues

      public boolean appliesToAdditionalValues()
      Specified by:
      appliesToAdditionalValues in interface CsticValueValidator
      Returns:
      true only if this validator is apllicable to additional cstic values