use of org.passay.EnglishCharacterData in project dataverse by IQSS.
the class PasswordValidatorUtil method parseConfigString.
/**
* Parses the list of character rules as defined in the database. Recall how
* configString is formatted: "UpperCase:1,LowerCase:1,Digit:1,Special:1"
*/
public static List<CharacterRule> parseConfigString(String configString) {
List<CharacterRule> characterRules = new ArrayList<>();
String[] typePlusNums = configString.split(",");
for (String typePlusNum : typePlusNums) {
String[] configArray = typePlusNum.split(":");
String type = configArray[0];
String num = configArray[1];
EnglishCharacterData typeData = EnglishCharacterData.valueOf(type);
characterRules.add(new CharacterRule(typeData, new Integer(num)));
}
return characterRules;
}
Aggregations