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.Common;
using Domain.Core.Entities;
using Infrastructure.Jwt;
using Microsoft.AspNetCore.Mvc;
using Service.Core.Auth;
using Service.Core.Jwt;
namespace API.Core.Controllers
{

View File

@@ -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<IUserService, UserService>();
builder.Services.AddScoped<IAuthRepository, AuthRepository>();
builder.Services.AddScoped<IAuthService, AuthService>();
builder.Services.AddScoped<IJwtService, JwtService>();
builder.Services.AddScoped<IPasswordService, PasswordService>();
builder.Services.AddScoped<IPasswordInfra, Argon2Infrastructure>();
var app = builder.Build();

View File

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

View File

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

View File

@@ -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
{

View File

@@ -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

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 bool Verify(string password, string stored);

View File

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

View File

@@ -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<UserAccount> 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;
}
}