Interface User
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final PropertyValue<Integer> Specifies the maximum allowed password length.static final PropertyValue<Integer> Specifies the maximum allowed username length. -
Method Summary
-
Field Details
-
MAXIMUM_USERNAME_LENGTH
Specifies the maximum allowed username length.- Value type: Integer
- Default value: 256
Userimplementation is first loaded; set it before then for it to take effect. -
MAXIMUM_PASSWORD_LENGTH
Specifies the maximum allowed password length.- Value type: Integer
- Default value: 1024
Userimplementation is first loaded; set it before then for it to take effect.
-
-
Method Details
-
username
String username()- Returns:
- the username
-
password
char[] password()- Returns:
- the password, an empty array in case of an empty password
-
clearPassword
-
copy
User copy()- Returns:
- a copy of this User
-
user
Creates a new User with an empty password.- Parameters:
username- the username- Returns:
- a new User
- Throws:
IllegalArgumentException- in case username is an empty string or exceedsMAXIMUM_USERNAME_LENGTH
-
user
Creates a new User.- Parameters:
username- the usernamepassword- the password- Returns:
- a new User
- Throws:
IllegalArgumentException- in case username is an empty string, username exceedsMAXIMUM_USERNAME_LENGTH, or password exceedsMAXIMUM_PASSWORD_LENGTH
-
parse
Parses a User from a string, containing a username and password with a single ':' as delimiter, i.e. "user:pass" or "user:" for an empty password. If no delimiter is found the whole string is assumed to be the username and the password empty. The username portion is trimmed. Any delimiters beyond the initial one are assumed to be part of the password.- Parameters:
userPassword- the username and password string- Returns:
- a User with the given username and password
- Throws:
IllegalArgumentException- in case the username portion is empty, username exceedsMAXIMUM_USERNAME_LENGTH, or password exceedsMAXIMUM_PASSWORD_LENGTH
-