Package net.datafaker.providers.base
Class Credentials
java.lang.Object
net.datafaker.providers.base.AbstractProvider<BaseProviders>
net.datafaker.providers.base.Credentials
Generates credentials such as usernames, uids and passwords.
- Since:
- 2.5.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intFields inherited from class net.datafaker.providers.base.AbstractProvider
faker -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionpassword()Generates a password, only with lowercase letters, numbers and with length between 8 and 16 characters.password(boolean includeDigit) Generates a password, only with lowercase letters and optionally numbers with length between 8 and 16 characters.password(int minimumLength, int maximumLength) Generates a password, only with lowercase letters, numbers and with min and max length defined by the user.password(int minimumLength, int maximumLength, boolean includeUppercase) Generates a password with lowercase and optionally uppercase letters, numbers and with min and max length defined by the user.password(int minimumLength, int maximumLength, boolean includeUppercase, boolean includeSpecial) Generates a password with lowercase letters, numbers and optionally uppercase letters and special characters and with min and max length defined by the user.password(int minimumLength, int maximumLength, boolean includeUppercase, boolean includeSpecial, boolean includeDigit) Generates a password with lowercase letters and optionally uppercase letters, numbers and special characters and with min and max length defined by the user.userId()Generates a user ID based on the regex pattern defined in the resource file.Generates a user ID based on the provided regex pattern.username()A lowercase username composed of the first_name and last_name joined with a '.'.Returns a weak password from a pre-defined list of common weak passwords.Methods inherited from class net.datafaker.providers.base.AbstractProvider
equals, getFaker, hashCode, loadGenerators, resolve, resolve, toString
-
Field Details
-
MIN_PASSWORD_LENGTH
public static final int MIN_PASSWORD_LENGTH- See Also:
-
MAX_PASSWORD_LENGTH
public static final int MAX_PASSWORD_LENGTH- See Also:
-
-
Constructor Details
-
Credentials
-
-
Method Details
-
username
A lowercase username composed of the first_name and last_name joined with a '.'. Some examples are:- (template)
Name.firstName().Name.lastName() - jim.jones
- jason.leigh
- tracy.jordan
- Returns:
- a random two part username.
- See Also:
- (template)
-
password
Generates a password, only with lowercase letters, numbers and with length between 8 and 16 characters.- Returns:
- A randomly generated password
-
password
Generates a password, only with lowercase letters and optionally numbers with length between 8 and 16 characters.- Parameters:
includeDigit- if true, the password will contain at least one digit- Returns:
- A randomly generated password
-
password
Generates a password, only with lowercase letters, numbers and with min and max length defined by the user.- Parameters:
minimumLength- the minimum length of the passwordmaximumLength- the maximum length of the password- Returns:
- A randomly generated password
-
password
Generates a password with lowercase and optionally uppercase letters, numbers and with min and max length defined by the user.- Parameters:
minimumLength- the minimum length of the passwordmaximumLength- the maximum length of the passwordincludeUppercase- if true, the password will contain at least one uppercase letter- Returns:
- A randomly generated password
-
password
public String password(int minimumLength, int maximumLength, boolean includeUppercase, boolean includeSpecial) Generates a password with lowercase letters, numbers and optionally uppercase letters and special characters and with min and max length defined by the user.- Parameters:
minimumLength- the minimum length of the passwordmaximumLength- the maximum length of the passwordincludeUppercase- if true, the password will contain at least one uppercase letterincludeSpecial- if true, the password will contain at least one special character- Returns:
- A randomly generated password
-
password
public String password(int minimumLength, int maximumLength, boolean includeUppercase, boolean includeSpecial, boolean includeDigit) Generates a password with lowercase letters and optionally uppercase letters, numbers and special characters and with min and max length defined by the user.- Parameters:
minimumLength- the minimum length of the passwordmaximumLength- the maximum length of the passwordincludeUppercase- if true, the password will contain at least one uppercase letterincludeSpecial- if true, the password will contain at least one special characterincludeDigit- if true, the password will contain at least one digit- Returns:
- A randomly generated password
-
weakPassword
Returns a weak password from a pre-defined list of common weak passwords. Some examples are:- 123456
- password
- qwerty
- Returns:
- a random weak password.
-
userId
Generates a user ID based on the regex pattern defined in the resource file. If the regex is null or invalid, it returns null.- Returns:
- A randomly generated user ID based on the regex or null if the regex is null or invalid
-
userId
Generates a user ID based on the provided regex pattern. If the regex is null or invalid, it returns null.- Parameters:
regex- The regex pattern to generate the user ID- Returns:
- A randomly generated user ID based on the regex or null if the regex is null or invalid
-