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..c1eb8e7 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 @@ -1,8 +1,5 @@ package com.worlabel.domain.auth.handler; -import com.worlabel.global.exception.CustomException; -import com.worlabel.global.exception.ErrorCode; -import com.worlabel.global.response.ErrorResponse; import jakarta.servlet.ServletException; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; @@ -21,9 +18,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..773a041 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 @@ -1,8 +1,5 @@ package com.worlabel.domain.auth.handler; -import com.worlabel.global.exception.CustomException; -import com.worlabel.global.exception.ErrorCode; -import com.worlabel.global.response.ErrorResponse; import jakarta.servlet.ServletException; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; @@ -21,12 +18,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/domain/workspace/controller/WorkspaceController.java b/backend/src/main/java/com/worlabel/domain/workspace/controller/WorkspaceController.java index d17ff23..e832f4b 100644 --- a/backend/src/main/java/com/worlabel/domain/workspace/controller/WorkspaceController.java +++ b/backend/src/main/java/com/worlabel/domain/workspace/controller/WorkspaceController.java @@ -12,8 +12,6 @@ import com.worlabel.global.annotation.CurrentUser; import com.worlabel.global.config.swagger.SwaggerApiError; import com.worlabel.global.config.swagger.SwaggerApiSuccess; import com.worlabel.global.exception.ErrorCode; -import com.worlabel.global.response.BaseResponse; -import com.worlabel.global.response.SuccessResponse; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.tags.Tag; diff --git a/backend/src/main/java/com/worlabel/global/advice/CustomControllerAdvice.java b/backend/src/main/java/com/worlabel/global/advice/CustomControllerAdvice.java index 673c590..f2b3873 100644 --- a/backend/src/main/java/com/worlabel/global/advice/CustomControllerAdvice.java +++ b/backend/src/main/java/com/worlabel/global/advice/CustomControllerAdvice.java @@ -2,8 +2,6 @@ package com.worlabel.global.advice; import com.amazonaws.Response; import com.worlabel.global.exception.CustomException; -import com.worlabel.global.exception.ErrorCode; -import com.worlabel.global.response.ErrorResponse; import com.worlabel.global.service.NotificationManager; import jakarta.servlet.http.HttpServletRequest; import lombok.RequiredArgsConstructor; @@ -16,7 +14,6 @@ import org.springframework.web.bind.MissingServletRequestParameterException; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.ResponseStatus; import org.springframework.web.bind.annotation.RestControllerAdvice; -import org.springframework.web.servlet.NoHandlerFoundException; import org.springframework.web.servlet.resource.NoResourceFoundException; import java.lang.reflect.Executable; 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); diff --git a/backend/src/main/java/com/worlabel/global/response/ErrorResponse.java b/backend/src/main/java/com/worlabel/global/response/ErrorResponse.java index 884da53..651f4e5 100644 --- a/backend/src/main/java/com/worlabel/global/response/ErrorResponse.java +++ b/backend/src/main/java/com/worlabel/global/response/ErrorResponse.java @@ -20,8 +20,6 @@ import java.util.stream.Collectors; @Getter public class ErrorResponse extends BaseResponse { - - public ErrorResponse(boolean isSuccess, int status, int code, String message, Errors errors) { super(isSuccess, status, code, message); super.errors = parseErrors(errors); diff --git a/backend/src/main/java/com/worlabel/global/response/SuccessResponse.java b/backend/src/main/java/com/worlabel/global/response/SuccessResponse.java deleted file mode 100644 index c8cdd15..0000000 --- a/backend/src/main/java/com/worlabel/global/response/SuccessResponse.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.worlabel.global.response; - -import org.springframework.http.HttpStatus; - -/** - * 성공시 응답 객체 - * - * @param 응답 데이터 타입 - */ -public class SuccessResponse extends BaseResponse { - /** - * 빈 응답 데이터 - 객체 생성시 보내는 빈 응답 데이터 - */ - private static final SuccessResponse EMPTY = new SuccessResponse<>(); - - /** - * 성공 응답 객체 생성자 - */ - public SuccessResponse() { - super(true, HttpStatus.OK.value(), 200, "success"); - } - - /** - * 성공 응답 객체 - * - * @param data 성공시 반환하는 데이터 - */ - public SuccessResponse(T data) { - super(true, 200, 200, "success"); - super.data = data; - } - - /** - * 빈 응답 리턴 - * - * @return 빈 응답 객체 - */ - public static SuccessResponse empty() { - return EMPTY; - } - - /** - * 데이터를 성공 응답 객체에 감싸서 보내는 메서드 - * - * @param data 응답 할 데이터 - * @param 응답 할 데이터 타입 - * @return 데이터를 감싼 응답 객체 - */ - public static SuccessResponse of(T data) { - return new SuccessResponse(data); - } - -} \ No newline at end of file