public class HaveIBeenPwnedRule extends Object implements Rule
haveibeenpwned.com
optionally allowing the usage of found passwords, but returns the number of found matches in
the metadata.| Modifier and Type | Field and Description |
|---|---|
static String |
ERROR_CODE
Error code for exposed passwords.
|
static String |
IO_ERROR_CODE
Error code for API IO errors.
|
| Constructor and Description |
|---|
HaveIBeenPwnedRule(String appName)
Create the rule, appName is required by the
API.
|
HaveIBeenPwnedRule(String appName,
String address)
Create the rule, appName is required by the
API.
|
| Modifier and Type | Method and Description |
|---|---|
void |
setAllowExposed(boolean allow)
Whether passwords found in the API should be considered valid.
|
void |
setAllowOnException(boolean allow)
If an exception occurs during accessing the api, the password will be allowed, if set to true.
|
void |
setConnectTimeout(Duration timeout)
maximum Duration for connecting to the API.
|
void |
setReadTimeout(Duration timeout)
maximum Duration for reading from the API.
|
RuleResult |
validate(PasswordData passwordData)
Validates the supplied password data per the requirements of this rule.
|
public static final String ERROR_CODE
public static final String IO_ERROR_CODE
public HaveIBeenPwnedRule(String appName)
appName - must not be nullpublic void setAllowExposed(boolean allow)
allow - false: the rule does not allow previously pwned passwords,
true: pwned passwords are allowed, but the number of matches is returned in the result.public void setConnectTimeout(Duration timeout)
timeout - for connecting.public void setReadTimeout(Duration timeout)
timeout - for reading.public void setAllowOnException(boolean allow)
allow - true: if the API is not accessible, any password is accepted.
false: Default, API must answer in time to allow the password.public RuleResult validate(PasswordData passwordData)
RuleCopyright © 2003-2024 Virginia Tech. All Rights Reserved.