Annotation Type Password
@Documented
@Constraint(validatedBy=PasswordValidator.class)
@Target({METHOD,FIELD,ANNOTATION_TYPE,CONSTRUCTOR,PARAMETER})
@Retention(RUNTIME)
public @interface Password
The annotated element must be a valid password.
Supported types are Strings, other Objects are transfered to Strings,
There are the following rules checked (with
Using
With
size limits should be checked by separate size annotation.
Supported types are Strings, other Objects are transfered to Strings,
null elements
are considered valid.There are the following rules checked (with
minRules parameter the number rules can
be defined that have to be fulfilled):
- lowercase
- upercase
- digits
- special character
blacklist you can give a comma separated list of words which are not allowed
to be part of the password. Default is no entry.Using
disalowedStartChars you can define characters which are not allowed as first
character in the password. Default is no entry.With
maxRepeatChar you can limit the repeat of a single character, default is 0
which means no limitation.size limits should be checked by separate size annotation.
- Author:
- Manfred Tremmel
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic @interfaceDefines severalPasswordannotations on the same element. -
Required Element Summary
Required ElementsModifier and TypeRequired ElementDescriptionintminimum number rules that have to be fulfilled. -
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionString[]Array of words which are not allowed as part of the password.String[]Characters which are not allowed at the beginning of a password.Class<?>[]groups to use.intmaximum repeats of a single character.localized message.localized message if blacklisted.localized message if maximum repeat of a char is reached in a row.localized message if start character is not allowed.Class<? extends jakarta.validation.Payload>[]payload whatever.
-
Element Details
-
minRules
int minRulesminimum number rules that have to be fulfilled.- Returns:
- number minimum required rules
-
-
-
message
String messagelocalized message.- Returns:
- localized validation message
- Default:
- "{de.knightsoftnet.validators.shared.Password.message}"
-
messageBlacklist
String messageBlacklistlocalized message if blacklisted.- Returns:
- error message for black listed passwords
- Default:
- "{de.knightsoftnet.validators.shared.PasswordBlacklist.message}"
-
messageStartCharacters
String messageStartCharacterslocalized message if start character is not allowed.- Returns:
- error message for not allowed start characters
- Default:
- "{de.knightsoftnet.validators.shared.PasswordStartChar.message}"
-
messageMaxRepeat
String messageMaxRepeatlocalized message if maximum repeat of a char is reached in a row.- Returns:
- error message for max repeat
- Default:
- "{de.knightsoftnet.validators.shared.PasswordMaxRepeat.message}"
-
groups
Class<?>[] groupsgroups to use.- Returns:
- array of validation groups
- Default:
- {}
-
blacklist
String[] blacklistArray of words which are not allowed as part of the password.- Returns:
- comma separated list of not allowed password
- Default:
- {}
-
disalowedStartChars
String[] disalowedStartCharsCharacters which are not allowed at the beginning of a password.- Returns:
- characters which are not allowed
- Default:
- {}
-
maxRepeatChar
int maxRepeatCharmaximum repeats of a single character.- Returns:
- maximum allowed repeated characters
- Default:
- 0
-
payload
Class<? extends jakarta.validation.Payload>[] payloadpayload whatever.- Returns:
- payload class
- Default:
- {}
-