This commit is contained in:
kp9lk
2026-11-27 10:00:32 +03:00
commit 7de029b4bd
13 changed files with 278 additions and 0 deletions
+25
View File
@@ -0,0 +1,25 @@
List<User> users =
[
new(1, "Алексей Смирнов", "alexey.smirnov@example.com", "P@ssw0rd123"),
new(2, "Елена Кузнецова", "elena.kuznetsova@example.com", "Qwerty2026!"),
new(3, "Дмитрий Попов", "dmitry.popov@example.com", "Dm1try#Pass"),
new(4, "Мария Соколова", "maria.sokolova@example.com", "Masha_9988"),
new(5, "Иван Лебедев", "ivan.lebedev@example.com", "Iv@n_Strong1")
];
var builder = WebApplication.CreateBuilder(args);
var app = builder.Build();
app.MapPost("/auth/signin", (AuthRequest request) =>
{
var findUser = users.FirstOrDefault(it => it.Email == request.Email);
if (findUser == null) return Results.NotFound();
if (findUser.Password != request.Password) return Results.Unauthorized();
return Results.Ok(new AuthResponse("bebebebebebebebebebebebbebebebe"));
});
app.Run();
record User(int Id, string Name, string Email, string Password);
record AuthRequest(string Email, string Password);
record AuthResponse(string token);
@@ -0,0 +1,23 @@
{
"$schema": "https://json.schemastore.org/launchsettings.json",
"profiles": {
"http": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "http://localhost:5120",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"https": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "https://localhost:7112;http://localhost:5120",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
@@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
</Project>
@@ -0,0 +1,9 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*"
}