diff --git a/src/TaxBaik.Web.Client/Components/Admin/Services/CustomAuthenticationStateProvider.cs b/src/TaxBaik.Web.Client/Components/Admin/Services/CustomAuthenticationStateProvider.cs index 6db091b..80c9265 100644 --- a/src/TaxBaik.Web.Client/Components/Admin/Services/CustomAuthenticationStateProvider.cs +++ b/src/TaxBaik.Web.Client/Components/Admin/Services/CustomAuthenticationStateProvider.cs @@ -71,7 +71,8 @@ public class CustomAuthenticationStateProvider : AuthenticationStateProvider } catch (Exception ex) { - _logger.LogError(ex, "인증 상태 조회 중 오류 발생"); + _logger.LogError(ex, "❌ 인증 상태 조회 중 오류 발생: {ExceptionType} - {Message} - {StackTrace}", + ex.GetType().Name, ex.Message, ex.StackTrace); return new AuthenticationState(new ClaimsPrincipal(new ClaimsIdentity())); } } @@ -80,13 +81,21 @@ public class CustomAuthenticationStateProvider : AuthenticationStateProvider { try { + if (string.IsNullOrEmpty(token)) + { + _logger.LogWarning("❌ 토큰이 비어있습니다"); + return null; + } + var handler = new JwtSecurityTokenHandler(); var jwtToken = handler.ReadJwtToken(token); var identity = new ClaimsIdentity(jwtToken.Claims, "jwt"); + _logger.LogInformation("✅ 토큰 검증 성공: {Claims} claims", jwtToken.Claims.Count()); return new ClaimsPrincipal(identity); } - catch + catch (Exception ex) { + _logger.LogError(ex, "❌ 토큰 검증 실패: {ExceptionType} - {Message}", ex.GetType().Name, ex.Message); return null; } }