From a038a12fcac9d5e2bc9cad229ed0cb884aac1697 Mon Sep 17 00:00:00 2001 From: Aaron Po Date: Thu, 12 Feb 2026 09:54:39 -0500 Subject: [PATCH] Update root namespaces --- src/Core/API/API.Core/Controllers/AuthController.cs | 2 +- src/Core/API/API.Core/Program.cs | 6 +++--- src/Core/Infrastructure/Infrastructure.Jwt/IJwtService.cs | 2 +- .../Infrastructure.Jwt/Infrastructure.Jwt.csproj | 2 +- src/Core/Infrastructure/Infrastructure.Jwt/JwtService.cs | 2 +- .../{PasswordService.cs => Argon2Infrastructure.cs} | 4 ++-- .../{IPasswordService.cs => IPasswordInfra.cs} | 4 ++-- .../Infrastructure.PasswordHashing.csproj | 2 +- src/Core/Service/Service.Core/Auth/AuthService.cs | 8 ++++---- 9 files changed, 16 insertions(+), 16 deletions(-) rename src/Core/Infrastructure/Infrastructure.PasswordHashing/{PasswordService.cs => Argon2Infrastructure.cs} (94%) rename src/Core/Infrastructure/Infrastructure.PasswordHashing/{IPasswordService.cs => IPasswordInfra.cs} (57%) diff --git a/src/Core/API/API.Core/Controllers/AuthController.cs b/src/Core/API/API.Core/Controllers/AuthController.cs index 0f22ea5..91440ff 100644 --- a/src/Core/API/API.Core/Controllers/AuthController.cs +++ b/src/Core/API/API.Core/Controllers/AuthController.cs @@ -1,9 +1,9 @@ using API.Core.Contracts.Auth; using API.Core.Contracts.Common; using Domain.Core.Entities; +using Infrastructure.Jwt; using Microsoft.AspNetCore.Mvc; using Service.Core.Auth; -using Service.Core.Jwt; namespace API.Core.Controllers { diff --git a/src/Core/API/API.Core/Program.cs b/src/Core/API/API.Core/Program.cs index b4def9f..33e20d6 100644 --- a/src/Core/API/API.Core/Program.cs +++ b/src/Core/API/API.Core/Program.cs @@ -1,12 +1,12 @@ using FluentValidation; using FluentValidation.AspNetCore; +using Infrastructure.Jwt; +using Infrastructure.PasswordHashing; using Microsoft.AspNetCore.Mvc; using Repository.Core.Repositories.Auth; using Repository.Core.Repositories.UserAccount; using Repository.Core.Sql; using Service.Core.Auth; -using Service.Core.Jwt; -using Service.Core.Password; using Service.Core.User; var builder = WebApplication.CreateBuilder(args); @@ -59,7 +59,7 @@ builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); -builder.Services.AddScoped(); +builder.Services.AddScoped(); var app = builder.Build(); diff --git a/src/Core/Infrastructure/Infrastructure.Jwt/IJwtService.cs b/src/Core/Infrastructure/Infrastructure.Jwt/IJwtService.cs index 969954a..b62d2e3 100644 --- a/src/Core/Infrastructure/Infrastructure.Jwt/IJwtService.cs +++ b/src/Core/Infrastructure/Infrastructure.Jwt/IJwtService.cs @@ -1,4 +1,4 @@ -namespace Service.Core.Jwt; +namespace Infrastructure.Jwt; public interface IJwtService { diff --git a/src/Core/Infrastructure/Infrastructure.Jwt/Infrastructure.Jwt.csproj b/src/Core/Infrastructure/Infrastructure.Jwt/Infrastructure.Jwt.csproj index 5461560..cddd219 100644 --- a/src/Core/Infrastructure/Infrastructure.Jwt/Infrastructure.Jwt.csproj +++ b/src/Core/Infrastructure/Infrastructure.Jwt/Infrastructure.Jwt.csproj @@ -3,7 +3,7 @@ net10.0 enable enable - Service.Core.Jwt + Infrastructure.Jwt diff --git a/src/Core/Infrastructure/Infrastructure.Jwt/JwtService.cs b/src/Core/Infrastructure/Infrastructure.Jwt/JwtService.cs index 41b2ed1..d0fba84 100644 --- a/src/Core/Infrastructure/Infrastructure.Jwt/JwtService.cs +++ b/src/Core/Infrastructure/Infrastructure.Jwt/JwtService.cs @@ -4,7 +4,7 @@ using Microsoft.IdentityModel.JsonWebTokens; using Microsoft.IdentityModel.Tokens; using JwtRegisteredClaimNames = System.IdentityModel.Tokens.Jwt.JwtRegisteredClaimNames; -namespace Service.Core.Jwt; +namespace Infrastructure.Jwt; public class JwtService : IJwtService { diff --git a/src/Core/Infrastructure/Infrastructure.PasswordHashing/PasswordService.cs b/src/Core/Infrastructure/Infrastructure.PasswordHashing/Argon2Infrastructure.cs similarity index 94% rename from src/Core/Infrastructure/Infrastructure.PasswordHashing/PasswordService.cs rename to src/Core/Infrastructure/Infrastructure.PasswordHashing/Argon2Infrastructure.cs index 5d024de..ff47a77 100644 --- a/src/Core/Infrastructure/Infrastructure.PasswordHashing/PasswordService.cs +++ b/src/Core/Infrastructure/Infrastructure.PasswordHashing/Argon2Infrastructure.cs @@ -2,9 +2,9 @@ using System.Security.Cryptography; using System.Text; using Konscious.Security.Cryptography; -namespace Service.Core.Password; +namespace Infrastructure.PasswordHashing; -public class PasswordService : IPasswordService +public class Argon2Infrastructure : IPasswordInfra { private const int SaltSize = 16; // 128-bit private const int HashSize = 32; // 256-bit diff --git a/src/Core/Infrastructure/Infrastructure.PasswordHashing/IPasswordService.cs b/src/Core/Infrastructure/Infrastructure.PasswordHashing/IPasswordInfra.cs similarity index 57% rename from src/Core/Infrastructure/Infrastructure.PasswordHashing/IPasswordService.cs rename to src/Core/Infrastructure/Infrastructure.PasswordHashing/IPasswordInfra.cs index a5adb4a..9a2df0b 100644 --- a/src/Core/Infrastructure/Infrastructure.PasswordHashing/IPasswordService.cs +++ b/src/Core/Infrastructure/Infrastructure.PasswordHashing/IPasswordInfra.cs @@ -1,6 +1,6 @@ -namespace Service.Core.Password; +namespace Infrastructure.PasswordHashing; -public interface IPasswordService +public interface IPasswordInfra { public string Hash(string password); public bool Verify(string password, string stored); diff --git a/src/Core/Infrastructure/Infrastructure.PasswordHashing/Infrastructure.PasswordHashing.csproj b/src/Core/Infrastructure/Infrastructure.PasswordHashing/Infrastructure.PasswordHashing.csproj index 23b3af3..97afa1f 100644 --- a/src/Core/Infrastructure/Infrastructure.PasswordHashing/Infrastructure.PasswordHashing.csproj +++ b/src/Core/Infrastructure/Infrastructure.PasswordHashing/Infrastructure.PasswordHashing.csproj @@ -3,7 +3,7 @@ net10.0 enable enable - Service.Core.Password + Infrastructure.PasswordHashing diff --git a/src/Core/Service/Service.Core/Auth/AuthService.cs b/src/Core/Service/Service.Core/Auth/AuthService.cs index 9d13629..51dbbc8 100644 --- a/src/Core/Service/Service.Core/Auth/AuthService.cs +++ b/src/Core/Service/Service.Core/Auth/AuthService.cs @@ -1,12 +1,12 @@ using Domain.Core.Entities; +using Infrastructure.PasswordHashing; using Repository.Core.Repositories.Auth; -using Service.Core.Password; namespace Service.Core.Auth; public class AuthService( IAuthRepository authRepo, - IPasswordService passwordService + IPasswordInfra passwordInfra ) : IAuthService { public async Task RegisterAsync(UserAccount userAccount, string password) @@ -19,7 +19,7 @@ public class AuthService( } // password hashing - var hashed = passwordService.Hash(password); + var hashed = passwordInfra.Hash(password); // Register user with hashed password return await authRepo.RegisterUserAsync( @@ -43,6 +43,6 @@ public class AuthService( var activeCred = await authRepo.GetActiveCredentialByUserAccountIdAsync(user.UserAccountId); if (activeCred is null) return null; - return !passwordService.Verify(password, activeCred.Hash) ? null : user; + return !passwordInfra.Verify(password, activeCred.Hash) ? null : user; } }