Update root namespaces

This commit is contained in:
Aaron Po
2026-02-12 09:54:39 -05:00
parent 74c5528ea2
commit a038a12fca
9 changed files with 16 additions and 16 deletions

View File

@@ -1,9 +1,9 @@
using API.Core.Contracts.Auth; using API.Core.Contracts.Auth;
using API.Core.Contracts.Common; using API.Core.Contracts.Common;
using Domain.Core.Entities; using Domain.Core.Entities;
using Infrastructure.Jwt;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Service.Core.Auth; using Service.Core.Auth;
using Service.Core.Jwt;
namespace API.Core.Controllers namespace API.Core.Controllers
{ {

View File

@@ -1,12 +1,12 @@
using FluentValidation; using FluentValidation;
using FluentValidation.AspNetCore; using FluentValidation.AspNetCore;
using Infrastructure.Jwt;
using Infrastructure.PasswordHashing;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Repository.Core.Repositories.Auth; using Repository.Core.Repositories.Auth;
using Repository.Core.Repositories.UserAccount; using Repository.Core.Repositories.UserAccount;
using Repository.Core.Sql; using Repository.Core.Sql;
using Service.Core.Auth; using Service.Core.Auth;
using Service.Core.Jwt;
using Service.Core.Password;
using Service.Core.User; using Service.Core.User;
var builder = WebApplication.CreateBuilder(args); var builder = WebApplication.CreateBuilder(args);
@@ -59,7 +59,7 @@ builder.Services.AddScoped<IUserService, UserService>();
builder.Services.AddScoped<IAuthRepository, AuthRepository>(); builder.Services.AddScoped<IAuthRepository, AuthRepository>();
builder.Services.AddScoped<IAuthService, AuthService>(); builder.Services.AddScoped<IAuthService, AuthService>();
builder.Services.AddScoped<IJwtService, JwtService>(); builder.Services.AddScoped<IJwtService, JwtService>();
builder.Services.AddScoped<IPasswordService, PasswordService>(); builder.Services.AddScoped<IPasswordInfra, Argon2Infrastructure>();
var app = builder.Build(); var app = builder.Build();

View File

@@ -1,4 +1,4 @@
namespace Service.Core.Jwt; namespace Infrastructure.Jwt;
public interface IJwtService public interface IJwtService
{ {

View File

@@ -3,7 +3,7 @@
<TargetFramework>net10.0</TargetFramework> <TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<RootNamespace>Service.Core.Jwt</RootNamespace> <RootNamespace>Infrastructure.Jwt</RootNamespace>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@@ -4,7 +4,7 @@ using Microsoft.IdentityModel.JsonWebTokens;
using Microsoft.IdentityModel.Tokens; using Microsoft.IdentityModel.Tokens;
using JwtRegisteredClaimNames = System.IdentityModel.Tokens.Jwt.JwtRegisteredClaimNames; using JwtRegisteredClaimNames = System.IdentityModel.Tokens.Jwt.JwtRegisteredClaimNames;
namespace Service.Core.Jwt; namespace Infrastructure.Jwt;
public class JwtService : IJwtService public class JwtService : IJwtService
{ {

View File

@@ -2,9 +2,9 @@ using System.Security.Cryptography;
using System.Text; using System.Text;
using Konscious.Security.Cryptography; 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 SaltSize = 16; // 128-bit
private const int HashSize = 32; // 256-bit private const int HashSize = 32; // 256-bit

View File

@@ -1,6 +1,6 @@
namespace Service.Core.Password; namespace Infrastructure.PasswordHashing;
public interface IPasswordService public interface IPasswordInfra
{ {
public string Hash(string password); public string Hash(string password);
public bool Verify(string password, string stored); public bool Verify(string password, string stored);

View File

@@ -3,7 +3,7 @@
<TargetFramework>net10.0</TargetFramework> <TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<RootNamespace>Service.Core.Password</RootNamespace> <RootNamespace>Infrastructure.PasswordHashing</RootNamespace>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@@ -1,12 +1,12 @@
using Domain.Core.Entities; using Domain.Core.Entities;
using Infrastructure.PasswordHashing;
using Repository.Core.Repositories.Auth; using Repository.Core.Repositories.Auth;
using Service.Core.Password;
namespace Service.Core.Auth; namespace Service.Core.Auth;
public class AuthService( public class AuthService(
IAuthRepository authRepo, IAuthRepository authRepo,
IPasswordService passwordService IPasswordInfra passwordInfra
) : IAuthService ) : IAuthService
{ {
public async Task<UserAccount> RegisterAsync(UserAccount userAccount, string password) public async Task<UserAccount> RegisterAsync(UserAccount userAccount, string password)
@@ -19,7 +19,7 @@ public class AuthService(
} }
// password hashing // password hashing
var hashed = passwordService.Hash(password); var hashed = passwordInfra.Hash(password);
// Register user with hashed password // Register user with hashed password
return await authRepo.RegisterUserAsync( return await authRepo.RegisterUserAsync(
@@ -43,6 +43,6 @@ public class AuthService(
var activeCred = await authRepo.GetActiveCredentialByUserAccountIdAsync(user.UserAccountId); var activeCred = await authRepo.GetActiveCredentialByUserAccountIdAsync(user.UserAccountId);
if (activeCred is null) return null; if (activeCred is null) return null;
return !passwordService.Verify(password, activeCred.Hash) ? null : user; return !passwordInfra.Verify(password, activeCred.Hash) ? null : user;
} }
} }