org.appng.api.auth

## Interface PasswordPolicy

- All Known Implementing Classes:
    ConfigurablePasswordPolicy, DefaultPasswordPolicy

      public interface PasswordPolicy

  A `PasswordPolicy` defines how a valid password looks like, is able to create such a password and to check whether a given character-sequence is a valid password according to the requirements.
  Author:
    Matthias Müller

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Interface and Description
    --- | ---
    `static class` | `PasswordPolicy.ValidationResult` Holds the result of validating a password.

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `LOWERCASE` lowercase letters a-z
    `static String` | `NUMBER` numbers 0-9
    `static String` | `PUNCT` punctuation characters !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~
    `static String` | `UPPERCASE` uppercase letters A-Z

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `default void` | `configure(Properties platformProperties)` Configures the `PasswordPolicy`
    `String` | `generatePassword()` Generates a new random password that matches the requirements and returns it.
    `String` | `getErrorMessageKey()` Deprecated. a `PasswordPolicy.ValidationResult` should be used, see `validatePassword(String, char[], char[])`
    `boolean` | `isValidPassword(char[] password)` Deprecated. will be removed in 2.x, use `validatePassword(String, char[], char[])` instead
    `default PasswordPolicy.ValidationResult` | `validatePassword(String username, char[] currentPassword, char[] password)` Validates the password an returns a `PasswordPolicy.ValidationResult`

- - ### Field Detail

    - #### NUMBER

          static final String NUMBER

      numbers 0-9
      See Also:
        Constant Field Values

    - #### LOWERCASE

          static final String LOWERCASE

      lowercase letters a-z
      See Also:
        Constant Field Values

    - #### UPPERCASE

          static final String UPPERCASE

      uppercase letters A-Z
      See Also:
        Constant Field Values

    - #### PUNCT

          static final String PUNCT

      punctuation characters !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~
      See Also:
        Constant Field Values

  - ### Method Detail

    - #### configure

          default void configure(Properties platformProperties)

      Configures the `PasswordPolicy`
      Parameters:
        `platformProperties` - the platform's `Properties`
      Since:
        1.21

    - #### isValidPassword

          @Deprecated
          boolean isValidPassword(char[] password)

      Deprecated. will be removed in 2.x, use `validatePassword(String, char[], char[])` instead
      Checks whether the given character-sequence is a valid password.
      Parameters:
        `password` - the character-sequence sequence to check
      Returns:
        `true` if the character-sequence is a valid password, `false` otherwise

    - #### validatePassword

          default PasswordPolicy.ValidationResult validatePassword(String username,
                                                                   char[] currentPassword,
                                                                   char[] password)

      Validates the password an returns a `PasswordPolicy.ValidationResult`
      Parameters:
        `username` - the username (can be `null`)
        `currentPassword` - the current password (can be `null`)
        `password` - the new password (must not be `null`)
      Returns:
        the validation result

    - #### getErrorMessageKey

          @Deprecated
          String getErrorMessageKey()

      Deprecated. a `PasswordPolicy.ValidationResult` should be used, see `validatePassword(String, char[], char[])`
      Returns the message-key of an errormessage for the case that the password doesn't match the requirements.
      Returns:
        the message key

    - #### generatePassword

          String generatePassword()

      Generates a new random password that matches the requirements and returns it.
      Returns:
        the randomly generated password

Copyright © 2011–2023 aiticon GmbH. All rights reserved.