mirror of
https://github.com/hmaxnl/DotBased.git
synced 2025-01-18 10:04:20 +01:00
[ADD] Added base options
This commit is contained in:
parent
44e64793b7
commit
797323789e
|
@ -1,7 +0,0 @@
|
||||||
namespace DotBased.AspNet.Authority.Interfaces;
|
|
||||||
|
|
||||||
public interface ISecurityVersionRepository<in TRepositoryObject>
|
|
||||||
{
|
|
||||||
public Task<long> GetSecurityVersionAsync(TRepositoryObject obj);
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,8 +1,9 @@
|
||||||
namespace DotBased.AspNet.Authority.Interfaces;
|
namespace DotBased.AspNet.Authority.Interfaces;
|
||||||
|
|
||||||
public interface IUserRepository<TUser, TId> : IVersionRepository<TUser>, ISecurityVersionRepository<TUser> where TUser : class where TId : IEquatable<TId>
|
public interface IUserRepository<TUser, TId> where TUser : class where TId : IEquatable<TId>
|
||||||
{
|
{
|
||||||
public Task<TUser?> GetUserByIdAsync(TId id);
|
public Task<TUser?> GetUserByIdAsync(TId id);
|
||||||
|
|
||||||
public Task<TId> GetUserIdAsync(TUser user);
|
public Task<TId> GetUserIdAsync(TUser user);
|
||||||
|
public Task SetVersion(TUser user, long version);
|
||||||
|
public Task SetSecurityVersion(TUser user, long version);
|
||||||
}
|
}
|
|
@ -1,6 +0,0 @@
|
||||||
namespace DotBased.AspNet.Authority.Interfaces;
|
|
||||||
|
|
||||||
public interface IVersionRepository<in TRepositoryObject>
|
|
||||||
{
|
|
||||||
public Task<long> GetVersionAsync(TRepositoryObject obj);
|
|
||||||
}
|
|
|
@ -17,7 +17,7 @@ public class AuthorityAttribute
|
||||||
|
|
||||||
public string BoundId { get; set; } // Bound to User, Group, Role id
|
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.
|
public string? Type { get; set; } // AspNet.Claim.Role/Property/Data.JSON, Data.Raw, Data.Base64 etc.
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,8 @@ public abstract class AuthorityUser<TKey> where TKey : IEquatable<TKey>
|
||||||
|
|
||||||
public bool Enabled { get; set; }
|
public bool Enabled { get; set; }
|
||||||
|
|
||||||
|
public bool Confirmed { get; set; }
|
||||||
|
|
||||||
public bool Locked { get; set; }
|
public bool Locked { get; set; }
|
||||||
|
|
||||||
public DateTime LockedDate { get; set; }
|
public DateTime LockedDate { get; set; }
|
||||||
|
|
10
DotBased.AspNet.Authority/Models/Options/AuthorityOptions.cs
Normal file
10
DotBased.AspNet.Authority/Models/Options/AuthorityOptions.cs
Normal file
|
@ -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();
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
namespace DotBased.AspNet.Authority.Models.Options;
|
||||||
|
|
||||||
|
public class LockdownOptions
|
||||||
|
{
|
||||||
|
public bool EnableLockout { get; set; }
|
||||||
|
}
|
|
@ -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);
|
||||||
|
}
|
14
DotBased.AspNet.Authority/Models/Options/PasswordOptions.cs
Normal file
14
DotBased.AspNet.Authority/Models/Options/PasswordOptions.cs
Normal file
|
@ -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<string> PasswordBlackList { get; set; } = ["password", "1234"];
|
||||||
|
public StringComparer PasswordBlackListComparer { get; set; } = StringComparer.OrdinalIgnoreCase;
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
namespace DotBased.AspNet.Authority.Models.Options;
|
||||||
|
|
||||||
|
public class ProviderOptions
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
|
@ -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; }
|
||||||
|
}
|
11
DotBased.AspNet.Authority/Models/Options/UserOptions.cs
Normal file
11
DotBased.AspNet.Authority/Models/Options/UserOptions.cs
Normal file
|
@ -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<string> UserNameBlackList { get; set; } = ["admin", "administrator", "dev", "developer"];
|
||||||
|
public StringComparer UserNameBlackListComparer { get; set; } = StringComparer.OrdinalIgnoreCase;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user