작업중: W4 관리자 로그인 구현 (BCrypt 인증)
TaxBaik CI/CD / build-and-deploy (push) Failing after 16s

- Login.razor: BCrypt 기반 실제 비밀번호 검증
- TaxBaik.Admin.csproj: BCrypt.Net-Next 패키지 추가
- HttpContext.SignInAsync로 쿠키 인증 처리

주의: 아직 런타임 이슈 수정 필요

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-06-26 17:00:03 +09:00
parent 66eb4aec77
commit dc9aa108a1
2 changed files with 52 additions and 2 deletions
+51 -2
View File
@@ -29,16 +29,65 @@
</MudPaper>
</MudContainer>
@using Microsoft.AspNetCore.Authentication
@using System.Security.Claims
@using TaxBaik.Domain.Interfaces
@code {
private MudForm form;
private bool isFormValid = false;
private string errorMessage = "";
private LoginModel model = new();
private bool isLoading = false;
[Inject]
private IAdminUserRepository AdminUserRepository { get; set; }
[Inject]
private NavigationManager NavigationManager { get; set; }
[Inject]
private HttpContextAccessor HttpContextAccessor { get; set; }
private async Task HandleLogin()
{
errorMessage = "로그인 기능은 준비 중입니다.";
if (!isFormValid) return;
isLoading = true;
errorMessage = "";
try
{
var user = await AdminUserRepository.GetByUsernameAsync(model.Username);
if (user == null || !BCrypt.Net.BCrypt.Verify(model.Password, user.PasswordHash))
{
errorMessage = "사용자명 또는 비밀번호가 올바르지 않습니다.";
isLoading = false;
return;
}
var claims = new List<Claim>
{
new Claim(ClaimTypes.NameIdentifier, user.Id.ToString()),
new Claim(ClaimTypes.Name, user.Username)
};
var claimsIdentity = new ClaimsIdentity(claims, CookieAuthenticationDefaults.AuthenticationScheme);
var authProperties = new AuthenticationProperties { IsPersistent = true };
await HttpContextAccessor.HttpContext.SignInAsync(
CookieAuthenticationDefaults.AuthenticationScheme,
new ClaimsPrincipal(claimsIdentity),
authProperties);
NavigationManager.NavigateTo("/taxbaik/admin/dashboard");
}
catch (Exception ex)
{
errorMessage = $"로그인 중 오류: {ex.Message}";
}
finally
{
isLoading = false;
}
}
private class LoginModel
+1
View File
@@ -13,6 +13,7 @@
<ItemGroup>
<PackageReference Include="MudBlazor" Version="6.9.4" />
<PackageReference Include="BCrypt.Net-Next" Version="4.0.3" />
</ItemGroup>
</Project>