Class PasswordPolicy
java.lang.Object
com.irurueta.authserver.authorization.domain.password.PasswordPolicy
Password rules in the style of NIST SP 800-63B: a minimum and a maximum length, no composition rules (no required
digits, symbols or upper-case letters) and a password that does not contain the username. The policy has no state,
so a single instance can be shared.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intMaximum number of characters of a password.static final intMinimum number of characters of a password. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanTells whether a candidate password follows every rule.violations(String username, String password) Finds the rules a candidate password breaks.
-
Field Details
-
MIN_LENGTH
public static final int MIN_LENGTHMinimum number of characters of a password.- See Also:
-
MAX_LENGTH
public static final int MAX_LENGTHMaximum number of characters of a password.- See Also:
-
-
Constructor Details
-
PasswordPolicy
public PasswordPolicy()
-
-
Method Details
-
violations
Finds the rules a candidate password breaks.- Parameters:
username- name of the account the password is for; the username rule is skipped when it isnullor blank.password- the candidate password;nullis treated as an empty password.- Returns:
- the broken rules, empty when the password is acceptable.
-
isValid
Tells whether a candidate password follows every rule.- Parameters:
username- name of the account the password is for.password- the candidate password.- Returns:
truewhen no rule is broken.
-