01: package org.manentia.kasai.user.passwordvalidators;
02:
03: import java.util.ResourceBundle;
04:
05: import org.apache.commons.lang.math.NumberUtils;
06: import org.manentia.kasai.Constants;
07:
08: public class LengthPasswordValidator implements PasswordValidator {
09:
10: public boolean validate(String password) {
11: boolean result = false;
12:
13: ResourceBundle res = ResourceBundle
14: .getBundle(Constants.CONFIG_PROPERTY_FILE);
15: int minLength = NumberUtils.toInt(res
16: .getString("lengthPasswordValidator.minLength"));
17:
18: if (minLength > 0) {
19: result = (password != null)
20: && password.length() >= minLength;
21: } else {
22: result = true;
23: }
24:
25: return result;
26: }
27:
28: }
|