@Test public void generate() { String s = ApplicationSecretGenerator.generate(); System.out.println(s); assertThat(s).isNotNull(); assertThat(s.length()).isEqualTo(64); }
public static String generate() { Random random = new SecureRandom(); StringBuilder secret = new StringBuilder(); for (int i = 1; i <= 64; i++) { secret.append((char) (random.nextInt(74) + 48)); } String r = secret.toString().replaceAll("\\\\+", "/"); if (r.length() != 64) { return generate(); } return r; }
ApplicationSecretGenerator { public static String generate() { Random random = new SecureRandom(); StringBuilder secret = new StringBuilder(); for (int i = 1; i <= 64; i++) { secret.append((char) (random.nextInt(74) + 48)); } String r = secret.toString().replaceAll("\\\\+", "/"); if (r.length() != 64) { return generate(); } return r; } }
ApplicationSecretGenerator { public static String generate() { Random random = new SecureRandom(); StringBuilder secret = new StringBuilder(); for (int i = 1; i <= 64; i++) { secret.append((char) (random.nextInt(74) + 48)); } String r = secret.toString().replaceAll("\\\\+", "/"); if (r.length() != 64) { return generate(); } return r; } private  ApplicationSecretGenerator(); }
ApplicationSecretGenerator { public static String generate() { Random random = new SecureRandom(); StringBuilder secret = new StringBuilder(); for (int i = 1; i <= 64; i++) { secret.append((char) (random.nextInt(74) + 48)); } String r = secret.toString().replaceAll("\\\\+", "/"); if (r.length() != 64) { return generate(); } return r; } private  ApplicationSecretGenerator(); static String generate(); static void ensureOrGenerateSecret(MavenProject project, Log log); static void generateFakeConfiguration(File output); }
ApplicationSecretGenerator { public static String generate() { Random random = new SecureRandom(); StringBuilder secret = new StringBuilder(); for (int i = 1; i <= 64; i++) { secret.append((char) (random.nextInt(74) + 48)); } String r = secret.toString().replaceAll("\\\\+", "/"); if (r.length() != 64) { return generate(); } return r; } private  ApplicationSecretGenerator(); static String generate(); static void ensureOrGenerateSecret(MavenProject project, Log log); static void generateFakeConfiguration(File output); static Pattern OLD_SECRET_LINE_PATTERN; static Pattern SECRET_LINE_PATTERN; }