Class PasscodeRuleLength

java.lang.Object
com.thalesgroup.gemalto.fido2.authenticator.passcode.PasscodeRule
com.thalesgroup.gemalto.fido2.authenticator.passcode.PasscodeRuleLength

public class PasscodeRuleLength extends PasscodeRule
A PasscodeRule that requires the passcode length to be within a specific range. The allowed range is between 4 and 16 characters, inclusive.
Since:
1.3.0
  • Field Details

    • DEFAULT_MINIMUM_LENGTH

      public static final int DEFAULT_MINIMUM_LENGTH
      Default minimum passcode length. This value defaults to 6.
      Since:
      1.3.0
      See Also:
    • DEFAULT_MAXIMUM_LENGTH

      public static final int DEFAULT_MAXIMUM_LENGTH
      Default maximum possible passcode length. This value defaults to 8.
      Since:
      1.3.0
      See Also:
  • Constructor Details

    • PasscodeRuleLength

      public PasscodeRuleLength()
      Initializes the passcode length rule with the default minimum (6) and maximum (8) lengths.
      Since:
      1.3.0
    • PasscodeRuleLength

      public PasscodeRuleLength(int minLength, int maxLength)
      Initializes the passcode length rule with custom minimum and maximum lengths.
      Parameters:
      minLength - Minimum passcode length
      maxLength - Maximum passcode length
      Throws:
      IllegalArgumentException - if the lengths are outside the allowed range (4-16) or if minLength is greater than maxLength.
      Since:
      1.3.0
  • Method Details

    • setMinimumLength

      public boolean setMinimumLength(int length)
      Sets the minimum required passcode length.
      Parameters:
      length - The minimum length. Must be between 4 and the current maximum length.
      Returns:
      true if the length was set successfully, false otherwise (e.g., if the value was invalid).
      Since:
      1.3.0
    • setMaximumLength

      public boolean setMaximumLength(int length)
      Sets the maximum allowed passcode length.
      Parameters:
      length - The maximum length. Must be between the current minimum length and 16.
      Returns:
      true if the length was set successfully, false otherwise (e.g., if the value was invalid).
      Since:
      1.3.0
    • getMinimumLength

      public int getMinimumLength()
      Gets the currently configured minimum length.
      Returns:
      The minimum passcode length.
      Since:
      1.3.0
    • getMaximumLength

      public int getMaximumLength()
      Gets the currently configured maximum length.
      Returns:
      The maximum passcode length.
      Since:
      1.3.0