public class ConfigurablePasswordPolicy extends Object implements PasswordPolicy
PasswordPolicy using a PasswordValidator.configurablePasswordPolicy can be used for configuration, defaults as
shown:
minLowerCase = 1
minUppercase = 1
minDigits = 1
minSpecialChars = 1
allowedSpecialChars = !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~
minLength = 8
maxLength = 255
useHistory = true
useUsername = true
numCharacterGroups = 4
allowOtherCharacters = false
allowWhiteSpace = false
generateLength = 8
generateLowerCase = 3
generateUppercase = 3
generateDigits = 1
generateSpecialChars = 1
PasswordPolicy.ValidationResultLOWERCASE, NUMBER, PUNCT, UPPERCASE| Constructor and Description |
|---|
ConfigurablePasswordPolicy() |
| Modifier and Type | Method and Description |
|---|---|
void |
configure(Properties platformProperties)
Configures the
PasswordPolicy |
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.
|
org.passay.PasswordValidator |
getValidator() |
boolean |
isValidPassword(char[] password)
Checks whether the given character-sequence is a valid password.
|
PasswordPolicy.ValidationResult |
validatePassword(String username,
char[] currentPassword,
char[] password)
Validates the password an returns a
PasswordPolicy.ValidationResult |
public void configure(Properties platformProperties)
PasswordPolicyPasswordPolicyconfigure in interface PasswordPolicyplatformProperties - the platform's Propertiespublic boolean isValidPassword(char[] password)
PasswordPolicyisValidPassword in interface PasswordPolicypassword - the character-sequence sequence to checktrue if the character-sequence is a valid password, false otherwisepublic PasswordPolicy.ValidationResult validatePassword(String username, char[] currentPassword, char[] password)
PasswordPolicyPasswordPolicy.ValidationResultvalidatePassword in interface PasswordPolicyusername - the username (can be null)currentPassword - the current password (can be null)password - the new password (must not be null)public String getErrorMessageKey()
PasswordPolicygetErrorMessageKey in interface PasswordPolicypublic String generatePassword()
PasswordPolicygeneratePassword in interface PasswordPolicypublic org.passay.PasswordValidator getValidator()
Copyright © 2011–2021 aiticon GmbH. All rights reserved.