@Test public void testGeneratePassword() { String actual = FreeIpaPasswordUtil.generatePassword(); long characterClasses = PATTERNS.stream().filter(actual::matches).count(); Assert.assertEquals(4, characterClasses); }
public static String generatePassword() { String upperCaseLetters = RandomStringUtils.randomAlphabetic(PWD_PART_LENGTH).toUpperCase(); String lowerCaseLetters = RandomStringUtils.randomAlphabetic(PWD_PART_LENGTH).toLowerCase(); String pwdPrefix = RandomStringUtils.randomAlphabetic(PWD_PREFIX_LENGTH); String numbers = RandomStringUtils.randomNumeric(PWD_PART_LENGTH); String raw = upperCaseLetters.concat(lowerCaseLetters).concat(numbers).concat(SPECIAL_CHARS); List<String> list = Arrays.asList(raw.split("")); Collections.shuffle(list); return pwdPrefix.concat(String.join("", list)); }
FreeIpaPasswordUtil { public static String generatePassword() { String upperCaseLetters = RandomStringUtils.randomAlphabetic(PWD_PART_LENGTH).toUpperCase(); String lowerCaseLetters = RandomStringUtils.randomAlphabetic(PWD_PART_LENGTH).toLowerCase(); String pwdPrefix = RandomStringUtils.randomAlphabetic(PWD_PREFIX_LENGTH); String numbers = RandomStringUtils.randomNumeric(PWD_PART_LENGTH); String raw = upperCaseLetters.concat(lowerCaseLetters).concat(numbers).concat(SPECIAL_CHARS); List<String> list = Arrays.asList(raw.split("")); Collections.shuffle(list); return pwdPrefix.concat(String.join("", list)); } }
FreeIpaPasswordUtil { public static String generatePassword() { String upperCaseLetters = RandomStringUtils.randomAlphabetic(PWD_PART_LENGTH).toUpperCase(); String lowerCaseLetters = RandomStringUtils.randomAlphabetic(PWD_PART_LENGTH).toLowerCase(); String pwdPrefix = RandomStringUtils.randomAlphabetic(PWD_PREFIX_LENGTH); String numbers = RandomStringUtils.randomNumeric(PWD_PART_LENGTH); String raw = upperCaseLetters.concat(lowerCaseLetters).concat(numbers).concat(SPECIAL_CHARS); List<String> list = Arrays.asList(raw.split("")); Collections.shuffle(list); return pwdPrefix.concat(String.join("", list)); } private  FreeIpaPasswordUtil(); }
FreeIpaPasswordUtil { public static String generatePassword() { String upperCaseLetters = RandomStringUtils.randomAlphabetic(PWD_PART_LENGTH).toUpperCase(); String lowerCaseLetters = RandomStringUtils.randomAlphabetic(PWD_PART_LENGTH).toLowerCase(); String pwdPrefix = RandomStringUtils.randomAlphabetic(PWD_PREFIX_LENGTH); String numbers = RandomStringUtils.randomNumeric(PWD_PART_LENGTH); String raw = upperCaseLetters.concat(lowerCaseLetters).concat(numbers).concat(SPECIAL_CHARS); List<String> list = Arrays.asList(raw.split("")); Collections.shuffle(list); return pwdPrefix.concat(String.join("", list)); } private  FreeIpaPasswordUtil(); static String generatePassword(); }
FreeIpaPasswordUtil { public static String generatePassword() { String upperCaseLetters = RandomStringUtils.randomAlphabetic(PWD_PART_LENGTH).toUpperCase(); String lowerCaseLetters = RandomStringUtils.randomAlphabetic(PWD_PART_LENGTH).toLowerCase(); String pwdPrefix = RandomStringUtils.randomAlphabetic(PWD_PREFIX_LENGTH); String numbers = RandomStringUtils.randomNumeric(PWD_PART_LENGTH); String raw = upperCaseLetters.concat(lowerCaseLetters).concat(numbers).concat(SPECIAL_CHARS); List<String> list = Arrays.asList(raw.split("")); Collections.shuffle(list); return pwdPrefix.concat(String.join("", list)); } private  FreeIpaPasswordUtil(); static String generatePassword();  }