Closed GaHee99 closed 9 months ago
아래 클래스에서 막히는 것 같은데, 단순히 if-else로 막아서그런듯.. `
@Component @RequiredArgsConstructor public class CustomAccessDeniedHandler implements AccessDeniedHandler { @Override public void handle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, AccessDeniedException accessDeniedException) throws IOException { val objectMapper = new ObjectMapper(); val exceptionMessage = determineExceptionMessage(httpServletRequest.getRequestURI()); val jsonResponse = objectMapper.writeValueAsString( ApiResponse.fail(exceptionMessage) ); httpServletResponse.setStatus(HttpStatus.FORBIDDEN.value()); httpServletResponse.setContentType(MediaType.APPLICATION_JSON_VALUE); httpServletResponse.setCharacterEncoding("UTF-8"); httpServletResponse.getWriter().write(jsonResponse); } private String determineExceptionMessage(String requestUri) { if (requestUri.contains("admin")) { return ExceptionMessage.NOT_ADMIN_USER.getMessage(); } else { return ExceptionMessage.PROFILE_UNCOMPLETED_USER.getMessage(); } } }
`
그런데, security filterchain에서 로직 확인 필요..
🧐 설명!
아래 클래스에서 막히는 것 같은데, 단순히 if-else로 막아서그런듯.. `
`
그런데, security filterchain에서 로직 확인 필요..