public class DefaultPasswordPolicy extends Object implements PasswordPolicy
PasswordPolicy
requiring 6 to 64 non-whitespace characters for a valid password.Modifier and Type | Field and Description |
---|---|
static String |
ERROR_MSSG_KEY |
static String |
REGEX |
LOWERCASE, NUMBER, PUNCT, UPPERCASE
Constructor and Description |
---|
DefaultPasswordPolicy() |
DefaultPasswordPolicy(String regEx,
String errorMessageKey) |
Modifier and Type | Method and Description |
---|---|
String |
generatePassword()
Generates a new random password that matches the requirements and returns it.
|
String |
getErrorMessageKey()
Returns the message-key of an errormessage for the case that the password doesn't match the requirements.
|
boolean |
isValidPassword(char[] password)
Checks whether the given character-sequence is a valid password.
|
public static final String REGEX
public static final String ERROR_MSSG_KEY
public boolean isValidPassword(char[] password)
PasswordPolicy
isValidPassword
in interface PasswordPolicy
password
- the character-sequence sequence to checktrue
if the character-sequence is a valid password, false
otherwisepublic String getErrorMessageKey()
PasswordPolicy
getErrorMessageKey
in interface PasswordPolicy
public String generatePassword()
PasswordPolicy
generatePassword
in interface PasswordPolicy
Copyright © 2011–2017 aiticon GmbH. All rights reserved.