Add JWT, OTP, and caching features

Upgraded projects to .NET 9.0 and added new projects `KBR.Cache`, `KBR.Shared`, and `KBR.Shared.Lite` to the solution. Introduced JWT authentication and OTP handling with new models, services, and configuration options. Updated database schema with new entities `Users` and `RefreshTokens`, and added migrations for schema changes. Implemented caching strategies using `AppDistributedCache` with support for in-memory, SQL Server, and Redis. Enhanced email handling with `MailHelpers` for domain replacement. Updated controllers, repositories, and configuration files to support new features.
This commit is contained in:
2025-11-22 06:52:59 +05:30
parent 912457755e
commit 3a7edb23c7
68 changed files with 13506 additions and 147 deletions
+21
View File
@@ -0,0 +1,21 @@
namespace KBR.Shared.Mail
{
public static class MailHelpers
{
// Replace email with other domain passed as a parameter
public static string ReplaceEmailDomain(string email, string newDomain)
{
if (string.IsNullOrWhiteSpace(email))
throw new ArgumentException("Email cannot be null or empty.", nameof(email));
if (string.IsNullOrWhiteSpace(newDomain))
throw new ArgumentException("New domain cannot be null or empty.", nameof(newDomain));
var atIndex = email.IndexOf('@');
if (atIndex == -1)
throw new ArgumentException("Invalid email format.", nameof(email));
return $"{email.Substring(0, atIndex + 1)}{newDomain}";
}
}
}