vt-middleware / passay

Password policy enforcement for Java.
http://www.passay.org
Other
282 stars 64 forks source link

Support cyrillic and other non latin languages, uppercase not detected #100

Closed pethers closed 5 years ago

pethers commented 5 years ago

private final PasswordValidator passwordValidator = new PasswordValidator(new LengthRule(8, 64), new CharacterRule(EnglishCharacterData.UpperCase, 1), new CharacterRule(EnglishCharacterData.LowerCase, 1), new CharacterRule(EnglishCharacterData.Digit, 1), new CharacterRule(EnglishCharacterData.Special, 1), new WhitespaceRule());

Sample password : ЭтотестРомен1!

will get error in validation

valid=false,details=[INSUFFICIENT_UPPERCASE:{minimumRequired=1, matchingCharacterCount=0, validCharacters=ABCDEFGHIJKLMNOPQRSTUVWXYZ, matchingCharacters=}, INSUFFICIENT_LOWERCASE:{minimumRequired=1, matchingCharacterCount=0, validCharacters=abcdefghijklmnopqrstuvwxyz, matchingCharacters=}],metadata=counts={UpperCase=0, Special=1, Digit=1, LowerCase=0, Length=14, Whitespace=0}

Java works well with toLowerCase,toUpperCase and isUpperCase,

Sample code CyrillicTest.txt

pethers commented 5 years ago

Fixed with custom implementation CharacterData interface.

dfish3r commented 5 years ago

If you have an implementation of CharacterData that you think is generally useful, feel free to open a PR to contribute. Thanks.