Skip to content

Commit df2742d

Browse files
committed
refactor: 오류 로그해결
1 parent 0221b72 commit df2742d

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/main/java/store/lastdance/config/SecurityConfig.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,11 @@ public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Excepti
7171
response.setContentType("application/json;charset=UTF-8");
7272
response.getWriter().write("{\"error\":\"Unauthorized\",\"message\":\"인증이 필요합니다.\"}");
7373
})
74+
.accessDeniedHandler((request, response, accessDeniedException) -> {
75+
response.setStatus(HttpStatus.FORBIDDEN.value());
76+
response.setContentType("application/json;charset=UTF-8");
77+
response.getWriter().write("{\"error\":\"Forbidden\",\"message\":\"접근 권한이 없습니다.\"}");
78+
})
7479
)
7580
.addFilterBefore(new JwtAuthenticationFilter(cookieUtils, authenticationProcessor),
7681
UsernamePasswordAuthenticationFilter.class);

0 commit comments

Comments
 (0)