Class PasswordValidator

java.lang.Object
de.knightsoftnet.validators.shared.impl.PasswordValidator
All Implemented Interfaces:
jakarta.validation.ConstraintValidator<Password,Object>

public class PasswordValidator extends Object implements jakarta.validation.ConstraintValidator<Password,Object>
Check passwords if they fulfill some complexity rules.
  • lowercase
  • upercase
  • digits
  • special character
Using blacklist you can give a array of words which are not allowed to be part of the password. Default is no entry.
Using disalowedStartChars you can define an array of characters (String) which are not allowed as first character in the password. Default is no entry.
With maxRepeatChar you can limit the repeat of a single character, default is 0 which means no limitation.
size limits should be added by separate size annotation.
Author:
Manfred Tremmel
  • Constructor Details

    • PasswordValidator

      public PasswordValidator()
  • Method Details

    • initialize

      public final void initialize(Password pconstraintAnnotation)
      initialize the validator.
      Specified by:
      initialize in interface jakarta.validation.ConstraintValidator<Password,Object>
      See Also:
      • ConstraintValidator.initialize(java.lang.annotation.Annotation)
    • isValid

      public final boolean isValid(Object pvalue, jakarta.validation.ConstraintValidatorContext pcontext)
      check if given object is valid.
      Specified by:
      isValid in interface jakarta.validation.ConstraintValidator<Password,Object>
      See Also:
      • ConstraintValidator.isValid(Object, jakarta.validation.ConstraintValidatorContext)