Constructor and Description |
---|
PasswordValidator(List<? extends Rule> rules)
Creates a new password validator with a
PropertiesMessageResolver . |
PasswordValidator(MessageResolver resolver,
List<? extends Rule> rules)
Creates a new password validator.
|
PasswordValidator(MessageResolver resolver,
Rule... rules)
|
PasswordValidator(Rule... rules)
|
Modifier and Type | Method and Description |
---|---|
double |
estimateEntropy(PasswordData passwordData)
Calculates the entropy of the given
PasswordData based on the specified password rules specified. |
MessageResolver |
getMessageResolver()
Returns the message resolver for this validator.
|
List<String> |
getMessages(RuleResult result)
Returns a list of human-readable messages by iterating over the details in a failed rule result.
|
List<? extends Rule> |
getRules()
Returns the password rules for this validator.
|
String |
toString() |
RuleResult |
validate(PasswordData passwordData)
Validates the supplied password data against the rules in this validator.
|
public PasswordValidator(Rule... rules)
rules
- to validatepublic PasswordValidator(List<? extends Rule> rules)
PropertiesMessageResolver
.rules
- to validatepublic PasswordValidator(MessageResolver resolver, Rule... rules)
resolver
- message resolver.rules
- to validatepublic PasswordValidator(MessageResolver resolver, List<? extends Rule> rules)
resolver
- message resolver.rules
- to validatepublic List<? extends Rule> getRules()
public MessageResolver getMessageResolver()
public RuleResult validate(PasswordData passwordData)
public double estimateEntropy(PasswordData passwordData)
PasswordData
based on the specified password rules specified. It's
important to note that this method does NOT take into account IllegalRegexRule
or AllowedRegexRule
as the regular expressions driving the rules may be negative matches.passwordData
- to estimate entropy forIllegalArgumentException
- for unknown PasswordData.Origin
or if the required CharacterRule
instances are unavailable in the passwordRules
of this validator instance.public List<String> getMessages(RuleResult result)
result
- failed rule result.Copyright © 2003-2024 Virginia Tech. All Rights Reserved.