-
Notifications
You must be signed in to change notification settings - Fork 801
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move IUserPasswordValidator to serenity
- Loading branch information
1 parent
82310fe
commit 6433614
Showing
3 changed files
with
56 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
src/Serenity.Net.Core/Authorization/IUserPasswordValidator.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
namespace Serenity.Abstractions; | ||
|
||
/// <summary> | ||
/// Abstraction to validate a user password | ||
/// </summary> | ||
public interface IUserPasswordValidator | ||
{ | ||
/// <summary> | ||
/// Validates a user password | ||
/// </summary> | ||
/// <param name="username"></param> | ||
/// <param name="password"></param> | ||
/// <returns><see cref="PasswordValidationResult.Valid"/> if given username and password is true</returns> | ||
PasswordValidationResult Validate(ref string username, string password); | ||
} |
40 changes: 40 additions & 0 deletions
40
src/Serenity.Net.Core/Authorization/PasswordValidationResult.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
namespace Serenity.ComponentModel; | ||
|
||
/// <summary> | ||
/// Password validation result | ||
/// </summary> | ||
public enum PasswordValidationResult | ||
{ | ||
/// <summary> | ||
/// Username is empty | ||
/// </summary> | ||
EmptyUsername, | ||
/// <summary> | ||
/// Password is empty | ||
/// </summary> | ||
EmptyPassword, | ||
/// <summary> | ||
/// User is not active | ||
/// </summary> | ||
InactiveUser, | ||
/// <summary> | ||
/// User source is not found | ||
/// </summary> | ||
UnknownSource, | ||
/// <summary> | ||
/// To many retries | ||
/// </summary> | ||
Throttle, | ||
/// <summary> | ||
/// Directory error | ||
/// </summary> | ||
DirectoryError, | ||
/// <summary> | ||
/// Invalid | ||
/// </summary> | ||
Invalid, | ||
/// <summary> | ||
/// Valid | ||
/// </summary> | ||
Valid | ||
} |