Package fr.paris.lutece.util.password
Class PasswordUtil
- java.lang.Object
-
- fr.paris.lutece.util.password.PasswordUtil
-
public final class PasswordUtil extends java.lang.ObjectUtility class used to generate random passwords
-
-
Field Summary
Fields Modifier and Type Field Description static intCONSTANT_DEFAULT_RANDOM_PASSWORD_SIZEstatic java.lang.StringPROPERTY_PASSWORD_SIZE
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleancheckPasswordFormat(java.lang.String strPassword)Check whether a password contains upper and lower case letters, special characters and numbers.static booleancheckPasswordFormat(java.lang.String strPassword, boolean bUpperAndLowerCase, boolean bNumero, boolean bSpecialCaracters)Check whether a password contains upper and lower case letters, special characters and numbers.static java.sql.TimestampgetPasswordMaxValidDate(int nNumberDay)Get the maximum valid date of a password starting from now with the given number of days.static java.lang.StringmakePassword()Generate a new random passwordstatic java.lang.StringmakePassword(int nPasswordSize, boolean bUpperAndLowerCase, boolean bNumbers, boolean bSpecialCaracters)Generate a new random password
-
-
-
Field Detail
-
PROPERTY_PASSWORD_SIZE
public static final java.lang.String PROPERTY_PASSWORD_SIZE
- See Also:
- Constant Field Values
-
CONSTANT_DEFAULT_RANDOM_PASSWORD_SIZE
public static final int CONSTANT_DEFAULT_RANDOM_PASSWORD_SIZE
- See Also:
- Constant Field Values
-
-
Method Detail
-
makePassword
public static java.lang.String makePassword()
Generate a new random password- Returns:
- the new password
-
makePassword
public static java.lang.String makePassword(int nPasswordSize, boolean bUpperAndLowerCase, boolean bNumbers, boolean bSpecialCaracters)Generate a new random password- Parameters:
nPasswordSize- the password sizebUpperAndLowerCase- true if the password must contain upper and lower casebNumbers- if the password must contain numbersbSpecialCaracters- if the password must contain special characters- Returns:
- the new password
-
checkPasswordFormat
public static boolean checkPasswordFormat(java.lang.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(java.lang.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 checkbUpperAndLowerCase- true if the password must contain upper and lower casebNumero- if the password must contain numerobSpecialCaracters- if the password must contain special characters- Returns:
- True if the password format is correct, false otherwise
-
getPasswordMaxValidDate
public static java.sql.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
-
-