Class PasscodeRuleLength
java.lang.Object
com.thalesgroup.gemalto.fido2.authenticator.passcode.PasscodeRule
com.thalesgroup.gemalto.fido2.authenticator.passcode.PasscodeRuleLength
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 Summary
FieldsModifier and TypeFieldDescriptionstatic final intDefault maximum possible passcode length.static final intDefault minimum passcode length. -
Constructor Summary
ConstructorsConstructorDescriptionInitializes the passcode length rule with the default minimum (6) and maximum (8) lengths.PasscodeRuleLength(int minLength, int maxLength) Initializes the passcode length rule with custom minimum and maximum lengths. -
Method Summary
Modifier and TypeMethodDescriptionintGets the currently configured maximum length.intGets the currently configured minimum length.booleansetMaximumLength(int length) Sets the maximum allowed passcode length.booleansetMinimumLength(int length) Sets the minimum required passcode length.
-
Field Details
-
DEFAULT_MINIMUM_LENGTH
public static final int DEFAULT_MINIMUM_LENGTHDefault minimum passcode length. This value defaults to 6.- Since:
- 1.3.0
- See Also:
-
DEFAULT_MAXIMUM_LENGTH
public static final int DEFAULT_MAXIMUM_LENGTHDefault 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 lengthmaxLength- Maximum passcode length- Throws:
IllegalArgumentException- if the lengths are outside the allowed range (4-16) or ifminLengthis greater thanmaxLength.- 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:
trueif the length was set successfully,falseotherwise (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:
trueif the length was set successfully,falseotherwise (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
-