public class PasswordGenerator extends Object
This class allows to configure the password requirements for:
It also allows to configure forbidden characters to accommodate the password requirements for the different clouds.
Example usage:
String password = new PasswordGenerator()
.lower().count(3) // Exactly three lower case characters
.upper().count(2) // Exactly 2 upper case characters
.numbers().min(5).exclude("012345".toCharArray()) // At least five numbers, from 6 to 9.
.symbols().min(6).max(10) // Between 6 and 10 special characters
.generate();
| Modifier and Type | Class and Description |
|---|---|
class |
PasswordGenerator.Config |
| Constructor and Description |
|---|
PasswordGenerator() |
| Modifier and Type | Method and Description |
|---|---|
String |
generate()
Generates a random password using the configured spec.
|
PasswordGenerator.Config |
lower()
Returns the lower case configuration.
|
PasswordGenerator.Config |
numbers()
Returns the numbers configuration.
|
PasswordGenerator.Config |
symbols()
Returns the special character configuration.
|
PasswordGenerator.Config |
upper()
Returns the upper case configuration.
|
public PasswordGenerator.Config lower()
public PasswordGenerator.Config upper()
public PasswordGenerator.Config numbers()
public PasswordGenerator.Config symbols()
public String generate()
Copyright © 2009-2018 The Apache Software Foundation. All Rights Reserved.