feat(api): integrate infra and implement password verification on login

This commit is contained in:
Stevan Freeborn
2026-02-03 04:38:40 -06:00
parent 91662f5629
commit c2b681d267
4 changed files with 21 additions and 11 deletions
+5 -1
View File
@@ -6,7 +6,11 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\FiscalOS.Core\FiscalOS.Core.csproj" />
<ProjectReference Include="..\FiscalOS.Infra\FiscalOS.Infra.csproj" />
</ItemGroup>
</Project>
+12 -1
View File
@@ -1,3 +1,6 @@
using FiscalOS.Core.Identity;
namespace FiscalOS.API.Login;
internal static class Endpoint
@@ -11,7 +14,8 @@ internal static class Endpoint
private static async Task<IResult> HandleAsync(
[FromBody] LoginRequest loginRequest,
[FromServices] AppDbContext appDbContext
[FromServices] AppDbContext appDbContext,
[FromServices] IPasswordHasher passwordHasher
)
{
// TODO: Implement actual auth flow
@@ -37,6 +41,13 @@ internal static class Endpoint
return Results.Unauthorized();
}
var isCorrectPassword = passwordHasher.Verify(loginRequest.Password, user.HashedPassword);
if (isCorrectPassword is false)
{
return Results.Unauthorized();
}
return Results.Ok();
}
}
+1 -5
View File
@@ -1,13 +1,9 @@
using FiscalOS.API.Data;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddValidation();
builder.Services.AddOpenApi();
builder.Services.ConfigureOptions<AppDbContextOptionsSetup>();
builder.Services.AddDbContext<AppDbContext>();
builder.Services.AddHostedService<MigrationService>();
builder.Services.AddInfrastructure();
var app = builder.Build();
+3 -4
View File
@@ -1,9 +1,8 @@
global using System.ComponentModel.DataAnnotations;
global using FiscalOS.API.Data;
global using FiscalOS.API.Identity;
global using FiscalOS.API.Login;
global using FiscalOS.Infra.Data;
global using FiscalOS.Infra.DependencyInjection;
global using Microsoft.AspNetCore.Mvc;
global using Microsoft.EntityFrameworkCore;
global using Microsoft.Extensions.Options;
global using Microsoft.EntityFrameworkCore;