Class RandomPasswordGenerator
java.lang.Object
com.serinity.accesscontrol.util.RandomPasswordGenerator
Utility class for generating cryptographically secure random passwords or
one-time codes.
Uses SecureRandom to produce random character
sequences drawn from uppercase, lowercase, digit, and special-character
pools. The default length is 6 characters, intended for short-lived
one-time reset codes.
NOTE: This class is not final by design; subclasses may extend it
to customise the character set or default length.
String code = RandomPasswordGenerator.generate(); // 6 chars
String pwd = RandomPasswordGenerator.generate(12); // 12 chars
- Since:
- 2026-02-16
- Version:
- 1.0
- Author:
- @ZouariOmar (zouariomar20@gmail.com)
- See Also:
-
Method Summary
-
Method Details
-
generate
Generates a random password of the default length (6 characters).- Returns:
- a randomly generated password string
-
generate
Generates a random password of the specified length.- Parameters:
length- the number of characters in the generated password- Returns:
- a randomly generated password string
-