Пример #1
0
 public static PasswordCheckerSettings CreateDefault()
 {
     var stt = new PasswordCheckerSettings();
       stt.Description = @"Password must be at least 10 characters long with at least 5 distinct charactres,
     and must contain at least one of the each of the following character types: upper-case letter,
     lower-case letter, digit, special symbol.";
       stt.ForbiddenTokens.UnionWith(new string[] { "password", "1234", "4321", "abcd", "xyz", "qwert", "asdf" });
       stt.StrengthLevels.Add(new StrengthLevelData() { Strength = PasswordStrength.Strong, MinLength = 10, MinDistinctLength = 5,
     Options = CharOptions.Letter | CharOptions.MixedCase | CharOptions.Digit | CharOptions.SpecialChar
       });
       stt.StrengthLevels.Add(new StrengthLevelData() {Strength = PasswordStrength.Medium, MinLength = 8, MinDistinctLength = 4,
     Options = CharOptions.Letter | CharOptions.Digit
       });
       return stt;
 }
Пример #2
0
        public static PasswordCheckerSettings CreateDefault()
        {
            var stt = new PasswordCheckerSettings();

            stt.Description = @"Password must be at least 10 characters long with at least 5 distinct charactres,
and must contain at least one of the each of the following character types: upper-case letter, 
lower-case letter, digit, special symbol.";
            stt.ForbiddenTokens.UnionWith(new string[] { "password", "1234", "4321", "abcd", "xyz", "qwert", "asdf" });
            stt.StrengthLevels.Add(new StrengthLevelData()
            {
                Strength = PasswordStrength.Strong, MinLength = 10, MinDistinctLength = 5,
                Options  = CharOptions.Letter | CharOptions.MixedCase | CharOptions.Digit | CharOptions.SpecialChar
            });
            stt.StrengthLevels.Add(new StrengthLevelData()
            {
                Strength = PasswordStrength.Medium, MinLength = 8, MinDistinctLength = 4,
                Options  = CharOptions.Letter | CharOptions.Digit
            });
            return(stt);
        }
Пример #3
0
 public PasswordStrengthChecker(EntityApp app, PasswordCheckerSettings settings = null)
 {
     _settings = settings ?? PasswordCheckerSettings.CreateDefault();
     app.RegisterConfig(_settings);
 }
Пример #4
0
 public PasswordStrengthChecker(EntityApp app, PasswordCheckerSettings settings = null)
 {
     _settings = settings ?? PasswordCheckerSettings.CreateDefault();
       app.RegisterConfig(_settings);
 }