diff --git a/DotBased.AspNet.Authority/Interfaces/ISecurityVersionRepository.cs b/DotBased.AspNet.Authority/Interfaces/ISecurityVersionRepository.cs deleted file mode 100644 index 866d22c..0000000 --- a/DotBased.AspNet.Authority/Interfaces/ISecurityVersionRepository.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace DotBased.AspNet.Authority.Interfaces; - -public interface ISecurityVersionRepository -{ - public Task GetSecurityVersionAsync(TRepositoryObject obj); - -} \ No newline at end of file diff --git a/DotBased.AspNet.Authority/Interfaces/IUserRepository.cs b/DotBased.AspNet.Authority/Interfaces/IUserRepository.cs index c7035a3..c2c420c 100644 --- a/DotBased.AspNet.Authority/Interfaces/IUserRepository.cs +++ b/DotBased.AspNet.Authority/Interfaces/IUserRepository.cs @@ -1,8 +1,9 @@ namespace DotBased.AspNet.Authority.Interfaces; -public interface IUserRepository : IVersionRepository, ISecurityVersionRepository where TUser : class where TId : IEquatable +public interface IUserRepository where TUser : class where TId : IEquatable { public Task GetUserByIdAsync(TId id); - public Task GetUserIdAsync(TUser user); + public Task SetVersion(TUser user, long version); + public Task SetSecurityVersion(TUser user, long version); } \ No newline at end of file diff --git a/DotBased.AspNet.Authority/Interfaces/IVersionRepository.cs b/DotBased.AspNet.Authority/Interfaces/IVersionRepository.cs deleted file mode 100644 index b88ec89..0000000 --- a/DotBased.AspNet.Authority/Interfaces/IVersionRepository.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace DotBased.AspNet.Authority.Interfaces; - -public interface IVersionRepository -{ - public Task GetVersionAsync(TRepositoryObject obj); -} \ No newline at end of file diff --git a/DotBased.AspNet.Authority/Models/Authority/AuthorityAttribute.cs b/DotBased.AspNet.Authority/Models/Authority/AuthorityAttribute.cs index dc4e5b5..1057db7 100644 --- a/DotBased.AspNet.Authority/Models/Authority/AuthorityAttribute.cs +++ b/DotBased.AspNet.Authority/Models/Authority/AuthorityAttribute.cs @@ -17,7 +17,7 @@ public class AuthorityAttribute public string BoundId { get; set; } // Bound to User, Group, Role id - public string? AttributeValue { get; set; } + public object? AttributeValue { get; set; } public string? Type { get; set; } // AspNet.Claim.Role/Property/Data.JSON, Data.Raw, Data.Base64 etc. diff --git a/DotBased.AspNet.Authority/Models/Authority/AuthorityUser.cs b/DotBased.AspNet.Authority/Models/Authority/AuthorityUser.cs index 7ed6f9b..bbc919f 100644 --- a/DotBased.AspNet.Authority/Models/Authority/AuthorityUser.cs +++ b/DotBased.AspNet.Authority/Models/Authority/AuthorityUser.cs @@ -22,6 +22,8 @@ public abstract class AuthorityUser where TKey : IEquatable public bool Enabled { get; set; } + public bool Confirmed { get; set; } + public bool Locked { get; set; } public DateTime LockedDate { get; set; } diff --git a/DotBased.AspNet.Authority/Models/Options/AuthorityOptions.cs b/DotBased.AspNet.Authority/Models/Options/AuthorityOptions.cs new file mode 100644 index 0000000..77f631c --- /dev/null +++ b/DotBased.AspNet.Authority/Models/Options/AuthorityOptions.cs @@ -0,0 +1,10 @@ +namespace DotBased.AspNet.Authority.Models.Options; + +public class AuthorityOptions +{ + public LockdownOptions Lockdown { get; set; } = new(); + public LockoutOptions Lockout { get; set; } = new(); + public PasswordOptions Password { get; set; } = new(); + public ProviderOptions Provider { get; set; } = new(); + public UserOptions User { get; set; } = new(); +} \ No newline at end of file diff --git a/DotBased.AspNet.Authority/Models/Options/LockdownOptions.cs b/DotBased.AspNet.Authority/Models/Options/LockdownOptions.cs new file mode 100644 index 0000000..aefbf76 --- /dev/null +++ b/DotBased.AspNet.Authority/Models/Options/LockdownOptions.cs @@ -0,0 +1,6 @@ +namespace DotBased.AspNet.Authority.Models.Options; + +public class LockdownOptions +{ + public bool EnableLockout { get; set; } +} \ No newline at end of file diff --git a/DotBased.AspNet.Authority/Models/Options/LockoutOptions.cs b/DotBased.AspNet.Authority/Models/Options/LockoutOptions.cs new file mode 100644 index 0000000..6debdbd --- /dev/null +++ b/DotBased.AspNet.Authority/Models/Options/LockoutOptions.cs @@ -0,0 +1,8 @@ +namespace DotBased.AspNet.Authority.Models.Options; + +public class LockoutOptions +{ + public bool EnableLockout { get; set; } = true; + public int FailedAttempts { get; set; } = 3; + public TimeSpan LockoutTimeout { get; set; } = TimeSpan.FromMinutes(30); +} \ No newline at end of file diff --git a/DotBased.AspNet.Authority/Models/Options/PasswordOptions.cs b/DotBased.AspNet.Authority/Models/Options/PasswordOptions.cs new file mode 100644 index 0000000..28000ba --- /dev/null +++ b/DotBased.AspNet.Authority/Models/Options/PasswordOptions.cs @@ -0,0 +1,14 @@ +namespace DotBased.AspNet.Authority.Models.Options; + +public class PasswordOptions +{ + public int RequiredLength { get; set; } = 10; + public int MinimalUniqueChars { get; set; } = 1; + public bool RequireLowercase { get; set; } + public bool RequireUppercase { get; set; } + public bool RequireDigit { get; set; } + public bool RequireNonAlphanumeric { get; set; } + + public List PasswordBlackList { get; set; } = ["password", "1234"]; + public StringComparer PasswordBlackListComparer { get; set; } = StringComparer.OrdinalIgnoreCase; +} \ No newline at end of file diff --git a/DotBased.AspNet.Authority/Models/Options/ProviderOptions.cs b/DotBased.AspNet.Authority/Models/Options/ProviderOptions.cs new file mode 100644 index 0000000..ba11c01 --- /dev/null +++ b/DotBased.AspNet.Authority/Models/Options/ProviderOptions.cs @@ -0,0 +1,6 @@ +namespace DotBased.AspNet.Authority.Models.Options; + +public class ProviderOptions +{ + +} \ No newline at end of file diff --git a/DotBased.AspNet.Authority/Models/Options/SignInOptions.cs b/DotBased.AspNet.Authority/Models/Options/SignInOptions.cs new file mode 100644 index 0000000..f25e2be --- /dev/null +++ b/DotBased.AspNet.Authority/Models/Options/SignInOptions.cs @@ -0,0 +1,8 @@ +namespace DotBased.AspNet.Authority.Models.Options; + +public class SignInOptions +{ + public bool RequireValidatedEmail { get; set; } + public bool RequireValidatedPhoneNumber { get; set; } + public bool RequireConfirmedAccount { get; set; } +} \ No newline at end of file diff --git a/DotBased.AspNet.Authority/Models/Options/UserOptions.cs b/DotBased.AspNet.Authority/Models/Options/UserOptions.cs new file mode 100644 index 0000000..54011e7 --- /dev/null +++ b/DotBased.AspNet.Authority/Models/Options/UserOptions.cs @@ -0,0 +1,11 @@ +namespace DotBased.AspNet.Authority.Models.Options; + +public class UserOptions +{ + public bool EnableRegister { get; set; } + public bool RequireUniqueEmail { get; set; } + public string AllowedCharacters { get; set; } = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._@"; + + public List UserNameBlackList { get; set; } = ["admin", "administrator", "dev", "developer"]; + public StringComparer UserNameBlackListComparer { get; set; } = StringComparer.OrdinalIgnoreCase; +} \ No newline at end of file