mirror of
https://github.com/scm-manager/scm-manager.git
synced 2026-02-07 07:09:15 +01:00
Fix server freeze during random token generation
This commit is contained in:
committed by
Thomas Zerr
parent
b6ac1f3668
commit
7b753e0981
2
gradle/changelog/random.yaml
Normal file
2
gradle/changelog/random.yaml
Normal file
@@ -0,0 +1,2 @@
|
||||
- type: fixed
|
||||
description: Server freeze during random token generation on startup
|
||||
@@ -18,17 +18,12 @@ package sonia.scm.lifecycle;
|
||||
|
||||
import org.apache.commons.lang.RandomStringUtils;
|
||||
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.SecureRandom;
|
||||
|
||||
final class RandomPasswordGenerator {
|
||||
|
||||
String createRandomPassword() {
|
||||
try {
|
||||
SecureRandom random = SecureRandom.getInstanceStrong();
|
||||
return RandomStringUtils.random(20, 0, 0, true, true, null, random);
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
throw new IllegalStateException("Every Java distribution is required to support a strong secure random generator; this should not have happened", e);
|
||||
}
|
||||
SecureRandom random = new SecureRandom();
|
||||
return RandomStringUtils.random(20, 0, 0, true, true, null, random);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user