diff --git a/DotBased.ASP.Auth/BasedAuthConfiguration.cs b/DotBased.ASP.Auth/BasedAuthConfiguration.cs index a996d1e..b09ecf0 100644 --- a/DotBased.ASP.Auth/BasedAuthConfiguration.cs +++ b/DotBased.ASP.Auth/BasedAuthConfiguration.cs @@ -3,7 +3,7 @@ namespace DotBased.ASP.Auth; public class BasedAuthConfiguration { /// - /// Allow users to registrate a user account. + /// Allow users to registrate. /// public bool AllowRegistration { get; set; } //TODO: Callback when a user registers, so the application can handle sending emails or generate a code to complete the registration. diff --git a/DotBased.ASP.Auth/Domains/Auth/RoleModel.cs b/DotBased.ASP.Auth/Domains/Auth/RoleModel.cs index 7822404..92b15c7 100644 --- a/DotBased.ASP.Auth/Domains/Auth/RoleModel.cs +++ b/DotBased.ASP.Auth/Domains/Auth/RoleModel.cs @@ -1,3 +1,5 @@ +using DotBased.Objects; + namespace DotBased.ASP.Auth.Domains.Auth; public class RoleModel @@ -6,4 +8,5 @@ public class RoleModel public string Name { get; set; } = string.Empty; public string Description { get; set; } = string.Empty; public List Permissions { get; set; } = []; + public List> Attributes { get; set; } = []; } \ No newline at end of file diff --git a/DotBased.ASP.Auth/Domains/Identity/GroupModel.cs b/DotBased.ASP.Auth/Domains/Identity/GroupModel.cs index 065f937..73ff377 100644 --- a/DotBased.ASP.Auth/Domains/Identity/GroupModel.cs +++ b/DotBased.ASP.Auth/Domains/Identity/GroupModel.cs @@ -1,4 +1,5 @@ using DotBased.ASP.Auth.Domains.Auth; +using DotBased.Objects; namespace DotBased.ASP.Auth.Domains.Identity; @@ -8,4 +9,5 @@ public class GroupModel public string Name { get; set; } = string.Empty; public string Description { get; set; } = string.Empty; public List Roles { get; set; } = []; + public List> Attributes { get; set; } = []; } \ No newline at end of file diff --git a/DotBased.ASP.Auth/Domains/Identity/UserModel.cs b/DotBased.ASP.Auth/Domains/Identity/UserModel.cs index ea92d97..b9a9f51 100644 --- a/DotBased.ASP.Auth/Domains/Identity/UserModel.cs +++ b/DotBased.ASP.Auth/Domains/Identity/UserModel.cs @@ -1,14 +1,31 @@ +using DotBased.ASP.Auth.Domains.Auth; +using DotBased.Objects; + namespace DotBased.ASP.Auth.Domains.Identity; public class UserModel { public string UserName { get; set; } = string.Empty; + public string PasswordHash { get; set; } = string.Empty; public string Email { get; set; } = string.Empty; + public string PhoneNumber { get; set; } = string.Empty; public string Name { get; set; } = string.Empty; public string FamilyName { get; set; } = string.Empty; + public DateTime Dob { get; set; } public string Id { get; set; } = Guid.NewGuid().ToString(); - public string PasswordHash { get; set; } = string.Empty; - public string[] GroupIds { get; set; } = Array.Empty(); - public string[] Roles { get; set; } = Array.Empty(); + public bool Enabled { get; set; } + public bool EmailValidated { get; set; } + public bool PhoneNumberConfirmed { get; set; } + public bool Lockout { get; set; } + public DateTime LockoutEnd { get; set; } + public DateTime CreationStamp { get; set; } + public DateTime SecurityStamp { get; set; } + public DateTime ConcurrencyStamp { get; set; } + public int AccessFailedCount { get; set; } + public bool ExternalAuthentication { get; set; } + + public List Groups { get; set; } = []; + public List Roles { get; set; } = []; + public List> Attributes { get; set; } = []; } \ No newline at end of file diff --git a/DotBased/Objects/DbObjectAttribute.cs b/DotBased/Objects/DbObjectAttribute.cs new file mode 100644 index 0000000..5a6eb78 --- /dev/null +++ b/DotBased/Objects/DbObjectAttribute.cs @@ -0,0 +1,14 @@ +using DotBased.Extensions; + +namespace DotBased.Objects; + +public class DbObjectAttribute : ObjectAttribute +{ + public DbObjectAttribute(string key, TValueType value, string owner) : base(key, value) + { + if (owner.IsNullOrWhiteSpace()) + throw new ArgumentNullException(nameof(owner), $"The parameter {nameof(owner)} is null or empty! This parameter is required!"); + Owner = owner; + } + public string Owner { get; set; } +} \ No newline at end of file diff --git a/DotBased/Objects/IObjectAttribute.cs b/DotBased/Objects/IObjectAttribute.cs new file mode 100644 index 0000000..83b3f37 --- /dev/null +++ b/DotBased/Objects/IObjectAttribute.cs @@ -0,0 +1,7 @@ +namespace DotBased.Objects; + +public interface IObjectAttribute +{ + public string Key { get; set; } + public TValueType? Value { get; set; } +} \ No newline at end of file diff --git a/DotBased/Objects/ObjectAttribute.cs b/DotBased/Objects/ObjectAttribute.cs new file mode 100644 index 0000000..a56298d --- /dev/null +++ b/DotBased/Objects/ObjectAttribute.cs @@ -0,0 +1,16 @@ +using DotBased.Extensions; + +namespace DotBased.Objects; + +public class ObjectAttribute : IObjectAttribute +{ + protected ObjectAttribute(string key, TValueType value) + { + if (key.IsNullOrWhiteSpace()) + throw new ArgumentNullException(nameof(key), $"The parameter {nameof(key)} is null or empty!"); + Key = key; + Value = value; + } + public string Key { get; set; } + public TValueType? Value { get; set; } +} \ No newline at end of file