Search in sources :

Example 1 with EnglishCharacterData

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;
}
Also used : EnglishCharacterData(org.passay.EnglishCharacterData) ArrayList(java.util.ArrayList) CharacterRule(org.passay.CharacterRule)

Aggregations

ArrayList (java.util.ArrayList)1 CharacterRule (org.passay.CharacterRule)1 EnglishCharacterData (org.passay.EnglishCharacterData)1