feat: wip on testing login flows

This commit is contained in:
Stevan Freeborn
2026-02-03 04:38:40 -06:00
parent 28e4692ca1
commit c037b895f0
12 changed files with 284 additions and 47 deletions
+11 -1
View File
@@ -9,7 +9,10 @@ internal static class Endpoint
return app.MapPost(Route, HandleAsync);
}
private static async Task<IResult> HandleAsync([FromBody] LoginRequest loginRequest)
private static async Task<IResult> HandleAsync(
[FromBody] LoginRequest loginRequest,
[FromServices] AppDbContext appDbContext
)
{
const string ADMIN_USERNAME = "Stevan";
const string ADMIN_PASSWORD = "@Password1";
@@ -30,6 +33,13 @@ internal static class Endpoint
// 1. We need a user model
// 2. We need a refresh token model
var user = await appDbContext.Users.SingleOrDefaultAsync(u => u.Username == loginRequest.Username);
if (user is null)
{
return Results.Unauthorized();
}
if (loginRequest.Username is not ADMIN_USERNAME || loginRequest.Password is not ADMIN_PASSWORD)
{
return Results.Unauthorized();