Initial Commit ...

This commit is contained in:
2024-01-25 04:42:47 +03:30
commit 844b4c47ad
50 changed files with 2615 additions and 0 deletions
+83
View File
@@ -0,0 +1,83 @@
using System.Collections.Generic;
using xIdentityModels.Dtos;
namespace xIdentityModels.Configurations {
public class XIdentityConfiguration {
//
// Define All Policies which can Apply to Identity Framework
// and also create a Default instance if it's not Exists
// in AppSetting JSON file ...
public XIdentityPolicy Policy { get; set; }
/// <summary>
/// the Security Key which used to Signing JWT Tokens
/// in Authentication Provider
/// </summary>
/// <value></value>
public string IdentitySecretKey { get; set; }
/// <summary>
/// the Issuer and Creator of Token
/// </summary>
/// <value></value>
public string IdentityIssuer { get; set; }
/// <summary>
/// the Audience and Consumer of Token
/// </summary>
/// <value></value>
public string IdentityAudience { get; set; }
/// <summary>
/// the List of Users Roles which must Provides in Identity
/// </summary>
/// <value></value>
public HashSet<string> IdentityRoles { get; set; }
/// <summary>
/// determines All new users must Assign to which role in Registration
/// </summary>
/// <value></value>
public string NewUsersRole { get; set; }
/// <summary>
/// determines New Registered Users Confirm Email or not
/// </summary>
/// <value></value>
public bool AutoConfirmNewUsersEmail { get; set; }
/// <summary>
/// determines New Registered Users Confirm PhoneNumber or not
/// </summary>
/// <value></value>
public bool AutoConfirmNewUsersPhoneNumber { get; set; }
/// <summary>
/// determines the Registration only Can be done with Invitation or not
/// </summary>
/// <value></value>
public bool RegistrationJustWithInvite { get; set; }
/// <summary>
/// determines the Registration required confirmation with email or not
/// </summary>
/// <value></value>
public bool RequireRegistrationConfirm { get; set; }
//
public int MaxNumberOfVerificationCodeSend { get; set; }
//
public int DeleyBetweenTwoVerificationCode { get; set; }
public int BannedDeviceTimeout { get; set; }
/// <summary>
/// an string Which Provide how long a action token can be valid
/// </summary>
/// <value></value>
public string ActionTokenExpirationDateProvider { get; set; }
public HashSet<XIdentityMessageDto> IdentityMessages { get; set; }
}
}
+37
View File
@@ -0,0 +1,37 @@
namespace xIdentityModels.Configurations {
/// <summary>
/// Provide the Available Policies with their Default Values
/// </summary>
public class XIdentityPolicy {
/// <summary>
/// User Account Lock Policies
/// </summary>
/// <value></value>
public XIdentityPolicyLockout Lockout { get; set; }
/// <summary>
/// User Password Policies
/// </summary>
/// <value></value>
public XIdentityPolicyPassword Password { get; set; }
/// <summary>
/// the Policies for User for Allowing to SignIn
/// </summary>
/// <value></value>
public XIdentityPolicySignIn SignIn { get; set; }
/// <summary>
/// the Policies for User
/// </summary>
/// <value></value>
public XIdentityPolicyUser User { get; set; }
/// <summary>
/// the policies which determines how to
/// populate user profile
/// </summary>
/// <value></value>
public XIdentityProfile Profile { get; set; }
}
}
+27
View File
@@ -0,0 +1,27 @@
namespace xIdentityModels.Configurations {
/// <summary>
/// User Account Lock Policies
/// </summary>
public class XIdentityPolicyLockout {
/// <summary>
/// The String which Provide Time Span Delais
/// between Lockout and UnLock a User Account
/// this Provided String the Parsed before Use
/// </summary>
/// <value></value>
public string LockoutTimeSpanProvider { get; set; }
/// <summary>
/// the Number of InvalidLoginAttemps which can
/// Happens to Lockout User Account
/// </summary>
/// <value></value>
public byte MaxFailedAccessAttempts { get; set; }
/// <summary>
/// determines Lockout mechanism allowed for new Users or not
/// </summary>
/// <value></value>
public bool AllowedForNewUsers { get; set; }
}
}
+42
View File
@@ -0,0 +1,42 @@
namespace xIdentityModels.Configurations {
/// <summary>
/// User Password Policies
/// </summary>
public class XIdentityPolicyPassword {
/// <summary>
/// determines Password must contains digits or not
/// </summary>
/// <value></value>
public bool RequireDigit { get; set; }
/// <summary>
/// determines the minimum allowed length for a password
/// </summary>
/// <value></value>
public byte RequiredLength { get; set; }
/// <summary>
/// determines the number of Unique Chars must be included in a Password
/// </summary>
/// <value></value>
public byte RequiredUniqueChars { get; set; }
/// <summary>
/// determines Password must contains LowerCase chars or not
/// </summary>
/// <value></value>
public bool RequireLowercase { get; set; }
/// <summary>
/// determines Password must contains Non-Alphabetical chars or not
/// </summary>
/// <value></value>
public bool RequireNonAlphanumeric { get; set; }
/// <summary>
/// determines Password must contains UpperCase chars or not
/// </summary>
/// <value></value>
public bool RequireUppercase { get; set; }
}
}
+26
View File
@@ -0,0 +1,26 @@
namespace xIdentityModels.Configurations {
/// <summary>
/// the Policies for User for Allowing to SignIn
/// </summary>
public class XIdentityPolicySignIn {
/// <summary>
/// determines only enabled users can SignIn
/// </summary>
/// <value></value>
public bool RequiredEnabled { get; set; }
/// <summary>
/// determines User must Confirm the given Email Address
/// before Login or not
/// </summary>
/// <value></value>
public bool RequireConfirmedEmail { get; set; }
/// <summary>
/// determines User must Confirm the given Phone Number
/// before Login or not
/// </summary>
/// <value></value>
public bool RequireConfirmedPhoneNumber { get; set; }
}
}
+50
View File
@@ -0,0 +1,50 @@
using System.Collections.Generic;
namespace xIdentityModels.Configurations {
/// <summary>
/// the Policies for User
/// </summary>
public class XIdentityPolicyUser {
/// <summary>
/// determines Allowed characters which can used in UserName
/// </summary>
/// <value></value>
public string AllowedUserNameCharacters { get; set; }
/// <summary>
/// determines the Email Address of each User must be Unique or not
/// </summary>
/// <value></value>
public bool RequireUniqueEmail { get; set; }
/// <summary>
/// minimum length of User Name
/// </summary>
/// <value></value>
public byte MinLength { get; set; }
/// <summary>
/// maximum length of user name
/// </summary>
/// <value></value>
public byte MaxLength { get; set; }
/// <summary>
/// Minimum Age for Registration
/// </summary>
/// <value></value>
public int MinAgeForRegistration { get; set; }
/// <summary>
/// Maximum age for Registration
/// </summary>
/// <value></value>
public int MaxAgeForRegistration { get; set; }
/// <summary>
/// a collection of invalid usernames
/// </summary>
/// <value></value>
public ICollection<string> InvalidUserNames { get; set; } = new HashSet<string> ();
}
}
+30
View File
@@ -0,0 +1,30 @@
namespace xIdentityModels.Configurations {
/// <summary>
/// contains user profile configuration
/// </summary>
public class XIdentityProfile {
/// <summary>
/// determines user profile contain email or not
/// </summary>
/// <value></value>
public bool ContainsEmail { get; set; }
/// <summary>
/// determines user profile contains phone number or not
/// </summary>
/// <value></value>
public bool ContainsPhoneNumber { get; set; }
/// <summary>
/// determines user profile contains Roles collection or not
/// </summary>
/// <value></value>
public bool ContainsRoles { get; set; }
public bool ContainsDateOfBirth { get; set; }
public bool ContainsLastLogin { get; set; }
public bool ContainsCreationDate { get; set; }
}
}