EzPasswordValidator 1.3.0
See the version list below for details.
dotnet add package EzPasswordValidator --version 1.3.0
NuGet\Install-Package EzPasswordValidator -Version 1.3.0
<PackageReference Include="EzPasswordValidator" Version="1.3.0" />
paket add EzPasswordValidator --version 1.3.0
#r "nuget: EzPasswordValidator, 1.3.0"
// Install EzPasswordValidator as a Cake Addin
#addin nuget:?package=EzPasswordValidator&version=1.3.0
// Install EzPasswordValidator as a Cake Tool
#tool nuget:?package=EzPasswordValidator&version=1.3.0
EzPasswordValidator
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: NO DEFAULT LENGTH IS ENFORCED - SET MANUALLY
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:
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:
- Anonymous method
- 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.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- No dependencies.
NuGet packages (3)
Showing the top 3 NuGet packages that depend on EzPasswordValidator:
Package | Downloads |
---|---|
LimFx.Common
A simple package contains basic crud functions, bad word replacer, rate limiter(throttling) and basic email service using mongodb |
|
Tindi.PasswordValidator.Library
Simple password validator validating password has min length of 6 , contains letters, digits and symbols. |
|
SpectreConsoleLibrary
Spectre.Console prompts pre-defined for common use |
GitHub repositories
This package is not used by any popular GitHub repositories.
v1.3.0 comes with a new feature and some bug fixes. For more details see the 'releases' section on the project site.