Package overit.geocall.base.util
Class UserPasswordUtil
java.lang.Object
overit.geocall.base.util.UserPasswordUtil
-
Method Summary
Modifier and TypeMethodDescriptionprotected static booleanisPasswordChanged(String newPassword, boolean isNewUser) Utility that checks if the new password has changed from the old one savedstatic voidpreparePassword(HashGetter newValues, HashGetter userValues) Utility method to prepare the password for saving.static voidvalidatePasswordConstraints(String pass, Identity identity) Utility method used to check the max length, min length and if the password respect all the constraints.static voidvalidatePasswordConstraints(String pass, Identity identity, HashGetter values)
-
Method Details
-
preparePassword
Utility method to prepare the password for saving. The new password and the used algorithm will be entered in thenewValuesHashGetterpassed as first input. The method uses the password found inside thenewValuesHashGetteras new password to be crypt. If the new value password is null, the original password, extracted from theuserValueHashGetterpassed as second parameter, will be entered in thenewValuesHashGetter.- Parameters:
newValues-HashGettercontains the value. The password to adapt will be searched inside, and the adapted value will be inserted inside. The keys used areFIELD_AUTEPASSfor password andFIELD_AUTEPASSALGfor password algorithm.userValues-HashGettercontains the user original values, as current password to change.
-
validatePasswordConstraints
public static void validatePasswordConstraints(String pass, Identity identity) throws DAValidateException Utility method used to check the max length, min length and if the password respect all the constraints.- Parameters:
pass- the password to check- Throws:
DAValidateException- if the password don't respect all the constraints
-
validatePasswordConstraints
public static void validatePasswordConstraints(String pass, Identity identity, HashGetter values) throws DAValidateException - Throws:
DAValidateException
-
isPasswordChanged
Utility that checks if the new password has changed from the old one saved- Parameters:
newPassword- the new password entered. If it is null, the password is not changed.isNewUser- boolean to indicate if it is a new user entry or an update- Returns:
trueif the password is changed or it is the new user, otherwisefalse
-