WASM 부팅 오류 디버깅: 상세 로깅 추가
## 변경사항 - CustomAuthenticationStateProvider: 예외 로깅 강화 - GetAuthenticationStateAsync: 예외 타입, 메시지, 스택 트레이스 로깅 - ValidateTokenWithoutDb: 토큰 검증 성공/실패 상세 로깅 - 토큰 비어있음 체크 추가 ## 목적 WASM 부팅 단계에서 발생하는 예외의 정확한 원인 파악 ## 다음 단계 1. 상세 로그로 예외 원인 확인 2. 원인에 따라 수정 (API 호출 실패, 토큰 검증 오류 등) 3. WASM 부팅 성공 검증 Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
+11
-2
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user