use of org.motechproject.security.validator.impl.MinLengthValidatorDecorator in project motech by motech.
the class SettingServiceImpl method getPasswordValidator.
@Override
public PasswordValidator getPasswordValidator() {
MotechSettings motechSettings = configurationService.getPlatformSettings();
String validatorName = motechSettings.getPasswordValidator();
PasswordValidator validator = null;
if (StringUtils.isNotBlank(validatorName)) {
LOGGER.debug("No password validator configured");
validator = passwordValidatorManager.getValidator(validatorName);
}
if (validator == null) {
validator = passwordValidatorManager.noneValidator();
}
// if min pass length configured, then decorate the validator
int minPassLength = getMinPasswordLength();
if (minPassLength > 0) {
validator = new MinLengthValidatorDecorator(validator, minPassLength);
}
return validator;
}
Aggregations