EzPasswordValidator 1.3.0

A .NET standard library for easy and customizable password validation. This library defines 11 predefined checks and an easy way to implement custom checks.

Install-Package EzPasswordValidator -Version 1.3.0
dotnet add package EzPasswordValidator --version 1.3.0
<PackageReference Include="EzPasswordValidator" Version="1.3.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add EzPasswordValidator --version 1.3.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

EzPasswordValidator

License: MIT

A .NET standard library for easy password validation.
This library defines 11 predefined checks and an easy way to implement custom checks.

Table of contents

  • Predefined checks
  • Install
  • Usage
  • How to contribute
  • License info

Checks

There are 11 predfined checks each representing a password criteria. Each check type is defined as a bit flag. A combination of checks can thus be simply refrenced using a single integer. All predefined check types are defined here.

Length check

Checks if the given password is equal to or longer than the required minimum length
and equal to or shorter than the maximum allowed length.

Default minimum length: 8     
Default maximum length: 128

Changing length bounds example:

validator.MinLength = 10;
validator.MaxLength = 256;

//OR

validator.SetLengthBounds(10, 256);
Check for numbers

Checks that the password contains at least one digit.

Check for letters

Checks that the password contains at least one letter. This check supports multiple alphabets. For more information about how we classify a letter see this refrence.

Check for symbols

Checks that the password contains at least one symbol.

Case check

Checks that the password contains at least one upper- and lower-case letter. This check supports multiple alphabets. For more information about how we classify a letter see this refrence.

Check for number sequences

Checks if the password contains a number series 3 or longer. Both increasing sequences and decreasing sequences are checked.

Example number sequence: 123  |  765
Check for number repetition

Checks if the password contains number repetition 3 or longer in length.

Example number repetition: 444  |  222
Check for number location

Checks that the password does not only have numbers in the front and/or end of the password. To pass this check the password must have a non-digit character before and after a digit character, only one digit must match this pattern.

Example invalid password: 2password   |  password2
Example valid   password: 2pass9word  |  p6ssword
Check for letter sequences

Checks if the password contains an alphabetical letter sequence consisting of four or more
characters. With the exception of the common three letter sequences: abc and xyz.
Note: this check currently only supports ISO basic latin alphabet (A-Z a-z).

Example letter sequence: abc  |  xyz  |  bcde
Check for letter repetition

Checks if the password contains letter repetition 3 or longer in length.
This check supports multiple alphabets. For more information about how we classify a letter see this refrence.
Note: This check is not case sensitive meaning 'aAA' and 'aaa' will both match.

Example letter repetition: aAA  |  bbb
Check for symbol repetition

Checks for immediate symbol repetition 3 or longer in sequence.

Example symbol repetiton: ///  |  @@@

Install

There are three main ways to install EzPasswordValidator:

  1. NuGet
  2. Download .dll from releases
  3. Manually build .dll from source

Usage

Example validator with predefined basic checks.

var validator = new PasswordValidator(CheckTypes.Basic);
Validate
bool isValid = validator.Validate(password);
Failed validation
foreach (Check failedCheck in validator.FailedChecks)
{
    
}
Add checks
Add single predefined check
 validator.AddCheck(CheckTypes.LetterSequence);
Add custom check

Custom checks can be added in two ways:

  1. Anonymous method
  2. Create a class that inherits EzPasswordValidator.Checks.CustomCheck
validator.AddCheck(nameof(MyCustomCheck), MyCustomCheck);
//or
validator.AddCheck("MyCustomCheckTag", psw => psw.Length > 8);
Add multiple checks
 validator.AddCheck(CheckTypes.Advanced);
 //or
 validator.AddCheck(288); //Number sequence check & letter sequence check
Remove checks
validator.RemoveCheck(CheckTypes.Symbols);
validator.RemoveCheck(1); //1 represents the length check
validator.RemoveCheck("MyCustomCheckTag"); //Removes the check with the given tag

Contribute

We welcome all contributions, please see the contribution guidelines.

License

This project is licensed under the MIT License - see LICENSE.md for details.

EzPasswordValidator

License: MIT

A .NET standard library for easy password validation.
This library defines 11 predefined checks and an easy way to implement custom checks.

Table of contents

  • Predefined checks
  • Install
  • Usage
  • How to contribute
  • License info

Checks

There are 11 predfined checks each representing a password criteria. Each check type is defined as a bit flag. A combination of checks can thus be simply refrenced using a single integer. All predefined check types are defined here.

Length check

Checks if the given password is equal to or longer than the required minimum length
and equal to or shorter than the maximum allowed length.

Default minimum length: 8     
Default maximum length: 128

Changing length bounds example:

validator.MinLength = 10;
validator.MaxLength = 256;

//OR

validator.SetLengthBounds(10, 256);
Check for numbers

Checks that the password contains at least one digit.

Check for letters

Checks that the password contains at least one letter. This check supports multiple alphabets. For more information about how we classify a letter see this refrence.

Check for symbols

Checks that the password contains at least one symbol.

Case check

Checks that the password contains at least one upper- and lower-case letter. This check supports multiple alphabets. For more information about how we classify a letter see this refrence.

Check for number sequences

Checks if the password contains a number series 3 or longer. Both increasing sequences and decreasing sequences are checked.

Example number sequence: 123  |  765
Check for number repetition

Checks if the password contains number repetition 3 or longer in length.

Example number repetition: 444  |  222
Check for number location

Checks that the password does not only have numbers in the front and/or end of the password. To pass this check the password must have a non-digit character before and after a digit character, only one digit must match this pattern.

Example invalid password: 2password   |  password2
Example valid   password: 2pass9word  |  p6ssword
Check for letter sequences

Checks if the password contains an alphabetical letter sequence consisting of four or more
characters. With the exception of the common three letter sequences: abc and xyz.
Note: this check currently only supports ISO basic latin alphabet (A-Z a-z).

Example letter sequence: abc  |  xyz  |  bcde
Check for letter repetition

Checks if the password contains letter repetition 3 or longer in length.
This check supports multiple alphabets. For more information about how we classify a letter see this refrence.
Note: This check is not case sensitive meaning 'aAA' and 'aaa' will both match.

Example letter repetition: aAA  |  bbb
Check for symbol repetition

Checks for immediate symbol repetition 3 or longer in sequence.

Example symbol repetiton: ///  |  @@@

Install

There are three main ways to install EzPasswordValidator:

  1. NuGet
  2. Download .dll from releases
  3. Manually build .dll from source

Usage

Example validator with predefined basic checks.

var validator = new PasswordValidator(CheckTypes.Basic);
Validate
bool isValid = validator.Validate(password);
Failed validation
foreach (Check failedCheck in validator.FailedChecks)
{
    
}
Add checks
Add single predefined check
 validator.AddCheck(CheckTypes.LetterSequence);
Add custom check

Custom checks can be added in two ways:

  1. Anonymous method
  2. Create a class that inherits EzPasswordValidator.Checks.CustomCheck
validator.AddCheck(nameof(MyCustomCheck), MyCustomCheck);
//or
validator.AddCheck("MyCustomCheckTag", psw => psw.Length > 8);
Add multiple checks
 validator.AddCheck(CheckTypes.Advanced);
 //or
 validator.AddCheck(288); //Number sequence check & letter sequence check
Remove checks
validator.RemoveCheck(CheckTypes.Symbols);
validator.RemoveCheck(1); //1 represents the length check
validator.RemoveCheck("MyCustomCheckTag"); //Removes the check with the given tag

Contribute

We welcome all contributions, please see the contribution guidelines.

License

This project is licensed under the MIT License - see LICENSE.md for details.

Release Notes

v1.3.0 comes with a new feature and some bug fixes. For more details see the 'releases' section on the project site.

  • .NETStandard 2.0

    • No dependencies.

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
1.3.0 88 6/8/2019
1.2.0 94 6/3/2019