This project was born to solve the problem of passwords security level checking
and it's based on the business rule.
A valid password must pass in these criterias:
- Nine or more characters
- At least 1 digit
- At least 1 lower character
- At least 1 upper character
- At least 1 special character which must to be
!@#$%^&*()-+
- It can't contains repeated characters
- It can't contains empty spaces
Click here to see more details about the specifications.
This project was designed to follow the principles of DDD which is responsible to advocates modeling based on the reality of business as relevant to your use cases. In the context of building applications, DDD talks about problems as domains.
In this project we needed to use the pattern Chain Of Responsibility to make sure that passwords are valid and respecting the business rules. You could check here the use of the pattern. Also it was divided into value objects containing the password assert rules, which are:
- PasswordCharQuantityValueObject
- PasswordContainsDigitValueObject
- PasswordContainsDistinctValueObject
- PasswordContainsEmptyValueObject
- PasswordContainsLowerValueObject
- PasswordContainsSpecialValueObject
- PasswordContainsUpperValueObject
- PasswordValueObject
-
Clone:
git clone [email protected]:anzileiro/verifiers.git
-
Run:
dotnet run --project Verifiers.Web/Verifiers.Web.csproj
In case of a valid password:
curl -X GET "https://localhost:5001/v1/Verifiers/passwords/abcdefghkl1@P"
{ "id":"17fe1a6c-9a82-4c09-aaeb-a9d376273dc7", "valid":true, "message":"The password matches all verifiers and it is valid." }
In case of an invalid password:
curl -X GET "https://localhost:5001/v1/Verifiers/passwords/abcdefghkl1@"
{ "id":"ce37d6d7-fb16-45f3-901d-70e25762ce58", "valid":false, "message":"The password must contains 1 or more upper characters." }
Also you could access and test from web:
-
Test:
dotnet test