Class PasswordValidator


  • public class PasswordValidator
    extends Object
    An utility class to validate the passwords
    Since:
    8.8.2
    Author:
    Marco Meschieri - LogicalDOC
    • Constructor Detail

      • PasswordValidator

        public PasswordValidator​(int length,
                                 int uppercaseChars,
                                 int lowercaseChars,
                                 int digits,
                                 int specialChars,
                                 int maxSequenceSize,
                                 int maxOccurrences,
                                 Properties messages)
        Constructor
        Parameters:
        length - minimum size of the password
        uppercaseChars - minimum number of upper case chars
        lowercaseChars - minimum number of lower case chars
        digits - minimum number of digits
        specialChars - minimum number of special chars
        maxSequenceSize - maximum size of a sequence
        maxOccurrences - maximum number of occurrences of the same char
        messages - optional map with error codes and messages
    • Method Detail

      • validate

        public List<String> validate​(String password)
        Validates a password
        Parameters:
        password - the password to check
        Returns:
        the list of error messages or empty in case of valid password