Class PasswordUtil

java.lang.Object
fr.paris.lutece.util.password.PasswordUtil

public final class PasswordUtil extends Object
Utility class used to generate random passwords
  • Field Details

    • PROPERTY_PASSWORD_SIZE

      public static final String PROPERTY_PASSWORD_SIZE
      See Also:
    • CONSTANT_DEFAULT_RANDOM_PASSWORD_SIZE

      public static final int CONSTANT_DEFAULT_RANDOM_PASSWORD_SIZE
      See Also:
  • Method Details

    • makePassword

      public static String makePassword()
      Generate a new random password
      Returns:
      the new password
    • makePassword

      public static String makePassword(int nPasswordSize, boolean bUpperAndLowerCase, boolean bNumbers, boolean bSpecialCaracters)
      Generate a new random password
      Parameters:
      nPasswordSize - the password size
      bUpperAndLowerCase - true if the password must contain upper and lower case
      bNumbers - if the password must contain numbers
      bSpecialCaracters - if the password must contain special characters
      Returns:
      the new password
    • checkPasswordFormat

      public static boolean checkPasswordFormat(String strPassword)
      Check whether a password contains upper and lower case letters, special characters and numbers.
      Parameters:
      strPassword - The password to check
      Returns:
      True if the password format is correct, false otherwise
    • checkPasswordFormat

      public static boolean checkPasswordFormat(String strPassword, boolean bUpperAndLowerCase, boolean bNumero, boolean bSpecialCaracters)
      Check whether a password contains upper and lower case letters, special characters and numbers.
      Parameters:
      strPassword - The password to check
      bUpperAndLowerCase - true if the password must contain upper and lower case
      bNumero - if the password must contain numero
      bSpecialCaracters - if the password must contain special characters
      Returns:
      True if the password format is correct, false otherwise
    • getPasswordMaxValidDate

      public static Timestamp getPasswordMaxValidDate(int nNumberDay)
      Get the maximum valid date of a password starting from now with the given number of days.
      Parameters:
      nNumberDay - The number of days the password is valid
      Returns:
      The maximum valid date of a password