diff --git a/backend/src/main/java/com/worlabel/domain/auth/handler/CustomAuthenticationDeniedHandler.java b/backend/src/main/java/com/worlabel/domain/auth/handler/CustomAuthenticationDeniedHandler.java index c07673c..1cecf0e 100644 --- a/backend/src/main/java/com/worlabel/domain/auth/handler/CustomAuthenticationDeniedHandler.java +++ b/backend/src/main/java/com/worlabel/domain/auth/handler/CustomAuthenticationDeniedHandler.java @@ -21,9 +21,5 @@ public class CustomAuthenticationDeniedHandler implements AccessDeniedHandler { public void handle(HttpServletRequest request, HttpServletResponse response, AccessDeniedException accessDeniedException) throws IOException, ServletException { log.debug("오류 : {}", request.getAttribute("error-message")); response.setStatus(HttpServletResponse.SC_FORBIDDEN); - CustomException exception = new CustomException(ErrorCode.ACCESS_DENIED); - ErrorResponse errorResponse = new ErrorResponse(exception, request.getAttribute("error-message").toString()); - response.setContentType("application/json;charset=utf-8"); - response.getWriter().write(errorResponse.toJson()); } } diff --git a/backend/src/main/java/com/worlabel/domain/auth/handler/CustomAuthenticationEntryPoint.java b/backend/src/main/java/com/worlabel/domain/auth/handler/CustomAuthenticationEntryPoint.java index 4c21a6a..e5391ba 100644 --- a/backend/src/main/java/com/worlabel/domain/auth/handler/CustomAuthenticationEntryPoint.java +++ b/backend/src/main/java/com/worlabel/domain/auth/handler/CustomAuthenticationEntryPoint.java @@ -21,12 +21,5 @@ public class CustomAuthenticationEntryPoint implements AuthenticationEntryPoint public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException authException) throws IOException, ServletException { log.debug("인증 실패 오류 : {} ", request.getAttribute("error-message")); response.setStatus(HttpServletResponse.SC_UNAUTHORIZED); - CustomException exception = new CustomException(ErrorCode.INVALID_TOKEN); - if (request.getAttribute("error-message") == null) { - request.setAttribute("error-message", exception.getMessage()); - } - ErrorResponse errorResponse = new ErrorResponse(exception, request.getAttribute("error-message").toString()); - response.setContentType("application/json;charset=UTF-8"); - response.getWriter().write(errorResponse.toJson()); } } diff --git a/backend/src/main/java/com/worlabel/global/filter/JwtAuthenticationFilter.java b/backend/src/main/java/com/worlabel/global/filter/JwtAuthenticationFilter.java index 328c5d3..39b4683 100644 --- a/backend/src/main/java/com/worlabel/global/filter/JwtAuthenticationFilter.java +++ b/backend/src/main/java/com/worlabel/global/filter/JwtAuthenticationFilter.java @@ -49,7 +49,6 @@ public class JwtAuthenticationFilter extends OncePerRequestFilter { throw new JwtException("유효한 JWT 토큰이 없습니다."); } } catch (Exception e) { - log.debug("message: {}", e.getMessage()); request.setAttribute("error-message", e.getMessage()); } filterChain.doFilter(request, response);