diff --git a/src/main/java/com/zatch/zatchserver/ResponseMessage.java b/src/main/java/com/zatch/zatchserver/ResponseMessage.java index f96626d..3051d83 100644 --- a/src/main/java/com/zatch/zatchserver/ResponseMessage.java +++ b/src/main/java/com/zatch/zatchserver/ResponseMessage.java @@ -8,6 +8,7 @@ public class ResponseMessage { public static final String CREATED_USER = "회원 가입 성공"; public static final String UPDATE_USER = "회원 정보 수정 성공"; public static final String DELETE_USER = "회원 탈퇴 성공"; + public static final String LOGOUT_SUCCESS = "로그아웃 성공"; public static final String USER_TOWN_SUCCESS = "회원 동네 설정 성공"; public static final String MY_PROFILE_SUCCESS = "내 프로필 불러오기 성공"; public static final String MYPAGE_SUCCESS = "마이페이지 불러오기 성공"; diff --git a/src/main/java/com/zatch/zatchserver/controller/UserController.java b/src/main/java/com/zatch/zatchserver/controller/UserController.java index cc80b77..8973072 100644 --- a/src/main/java/com/zatch/zatchserver/controller/UserController.java +++ b/src/main/java/com/zatch/zatchserver/controller/UserController.java @@ -13,6 +13,9 @@ import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.security.web.authentication.logout.SecurityContextLogoutHandler; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; @@ -30,7 +33,8 @@ public class UserController { private final AuthService authService; @ApiResponses(value = { - @ApiResponse(code = 200, message = "Success", response = GetUserResDto.class, examples = @Example(@ExampleProperty(value = "{'property1': 'value1', 'property2': 'value2'}", mediaType = MediaType.APPLICATION_JSON_VALUE))) + @ApiResponse(code = 200, message = "Success", response = GetUserResDto.class, + examples = @Example(@ExampleProperty(value = "{'property1': 'value1', 'property2': 'value2'}", mediaType = MediaType.APPLICATION_JSON_VALUE))) }) @PostMapping("/new") @ApiOperation(value = "회원가입", notes = "회원가입 API", produces = MediaType.APPLICATION_JSON_VALUE) @@ -89,7 +93,7 @@ public ResponseEntity postUser(@RequestBody PostUserReqDto postUserReqDto, HttpS @GetMapping("/logout") @ApiOperation(value="로그아웃", notes = "로그아웃 API") - public ResponseEntity logout(HttpServletRequest request) throws Exception{ + public ResponseEntity logout(HttpServletRequest request, HttpServletResponse response) throws Exception{ try { HttpSession session = request.getSession(); session.invalidate();