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, 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
    Using 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
    • Element Detail

      • minRules

        int minRules
        minimum number rules that have to be fulfilled.
        Returns:
        number minimum required rules
      • message

        String message
        localized message.
        Returns:
        localized validation message
        Default:
        "{de.knightsoftnet.validators.shared.Password.message}"
      • messageBlacklist

        String messageBlacklist
        localized message if blacklisted.
        Returns:
        error message for black listed passwords
        Default:
        "{de.knightsoftnet.validators.shared.PasswordBlacklist.message}"
      • messageStartCharacters

        String messageStartCharacters
        localized message if start character is not allowed.
        Returns:
        error message for not allowed start characters
        Default:
        "{de.knightsoftnet.validators.shared.PasswordStartChar.message}"
      • messageMaxRepeat

        String messageMaxRepeat
        localized 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<?>[] groups
        groups to use.
        Returns:
        array of validation groups
        Default:
        {}
      • blacklist

        String[] blacklist
        Array of words which are not allowed as part of the password.
        Returns:
        comma separated list of not allowed password
        Default:
        {}
      • disalowedStartChars

        String[] disalowedStartChars
        Characters which are not allowed at the beginning of a password.
        Returns:
        characters which are not allowed
        Default:
        {}
      • maxRepeatChar

        int maxRepeatChar
        maximum repeats of a single character.
        Returns:
        maximum allowed repeated characters
        Default:
        0
      • payload

        Class<? extends javax.validation.Payload>[] payload
        payload whatever.
        Returns:
        payload class
        Default:
        {}