public abstract class PasswordUtils extends Object
Some methods to work with passwords.
| Modifier and Type | Field and Description |
|---|---|
static String[] |
PARTIAL_REGEX_CHECKS
An array with regular expressions to validate the quality of a password:
PARTIAL_REGEX_CHECKS[0] : lower chars (a-z)
PARTIAL_REGEX_CHECKS[1] : upper chars (A-Z)
PARTIAL_REGEX_CHECKS[2] : numbers (0-9)
PARTIAL_REGEX_CHECKS[3] : symbols (
{@code ~! |
| Modifier and Type | Method and Description |
|---|---|
static String |
createRandomClearPassword()
Create a new random password (with symbols and a variable length greater than 14).
|
static String |
createRandomClearPassword(boolean withSymbols)
Create a new random password (with or without symbols and a variable length greater than 14).
|
static String |
createRandomClearPassword(int length)
Create a new random password with symbols and the specified length.
|
static String |
createRandomClearPassword(int length,
boolean withVariableLength,
boolean withSymbols)
Creates a new random password.
|
static double |
getPasswordQuality(String clearPassword,
Integer minLength)
Calculates the quality of the password.
|
public static final String[] PARTIAL_REGEX_CHECKS
PARTIAL_REGEX_CHECKS[0] : lower chars (a-z)PARTIAL_REGEX_CHECKS[1] : upper chars (A-Z)PARTIAL_REGEX_CHECKS[2] : numbers (0-9)PARTIAL_REGEX_CHECKS[3] : symbols (
~!@#$%^&*_-+=`|\(){}[]:;"'<>,.?/)public static String createRandomClearPassword()
public static String createRandomClearPassword(boolean withSymbols)
withSymbols - with or without symbols?public static String createRandomClearPassword(int length)
length - the length of the passwordpublic static String createRandomClearPassword(int length, boolean withVariableLength, boolean withSymbols)
length - the minimum length of the passwordwithVariableLength - should the length be variable?withSymbols - should the password contains symbols?public static double getPasswordQuality(String clearPassword, Integer minLength)
clearPassword - the clear passwordminLength - the minimum length of the password (optional)Copyright © 2017 bremersee.org. All rights reserved.