suesianne / vt-middleware

Automatically exported from code.google.com/p/vt-middleware
0 stars 0 forks source link

vt-password: CharacterCharacteristicsRule bug #203

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1.test bellow failure

expected false,but see true instead.

vt-password 3.1.2? window8 java java version "1.7.0_40"

Please provide any additional information below.

    @Test
    public void tCharacterCharacteristicRule2 (){
        CharacterCharacteristicsRule ccctr = new CharacterCharacteristicsRule();
        List<CharacterRule> crs = Lists.newArrayList();
        crs.add(new AlphabeticalCharacterRule(5));
        crs.add(new DigitCharacterRule(3));
        crs.add(new LowercaseCharacterRule(3));
        crs.add(new UppercaseCharacterRule(2));
        crs.add(new NonAlphanumericCharacterRule(1));

        ccctr.setRules(crs);

        ruleList.add(ccctr);

        PasswordValidator validator = new PasswordValidator(ruleList);
        PasswordData passwordData = new PasswordData(new Password("abcd"));
        RuleResult result = validator.validate(passwordData);
        pntResult(validator, result);
        Assert.assertFalse(result.isValid());

    }

Original issue reported on code.google.com by jianglibo@gmail.com on 11 Jan 2014 at 6:27

GoogleCodeExporter commented 8 years ago

Original comment by dfis...@gmail.com on 12 Jan 2014 at 4:21

GoogleCodeExporter commented 8 years ago
The CharacterCharacteristicRule by default requires one (1) rule to be met in 
order to for the rule to pass.
You've configured a LowercaseCharacterRule(3) and the password 'abcd' meets 
that characteristic.

If you invoke CharacterCharacteristicRule#setNumberOfCharacteristics with > 1 
you'll get the failure you expect.

Original comment by dfis...@gmail.com on 12 Jan 2014 at 4:26

GoogleCodeExporter commented 8 years ago
Rule working as designed.

Original comment by dfis...@gmail.com on 10 Mar 2014 at 6:45