Class PasswordValidator

  • All Implemented Interfaces:
    javax.validation.ConstraintValidator<Password,​Object>

    public class PasswordValidator
    extends Object
    implements javax.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 Detail

      • PasswordValidator

        public PasswordValidator()
    • Method Detail

      • initialize

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

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