From 22827a358416236fd54627b928dd57e476d76605 Mon Sep 17 00:00:00 2001 From: nayonsoso Date: Sun, 22 Dec 2024 00:42:27 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20=EB=A1=9C=EA=B7=B8=EC=95=84?= =?UTF-8?q?=EC=9B=83=20=EA=B5=AC=ED=98=84=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../auth/controller/AuthController.java | 20 +------------------ .../test/java/reviewme/api/AuthApiTest.java | 4 +--- 2 files changed, 2 insertions(+), 22 deletions(-) diff --git a/backend/src/main/java/reviewme/auth/controller/AuthController.java b/backend/src/main/java/reviewme/auth/controller/AuthController.java index aca5f1e04..14573f2fe 100644 --- a/backend/src/main/java/reviewme/auth/controller/AuthController.java +++ b/backend/src/main/java/reviewme/auth/controller/AuthController.java @@ -1,11 +1,8 @@ package reviewme.auth.controller; import jakarta.servlet.http.HttpServletRequest; -import jakarta.servlet.http.HttpSession; import jakarta.validation.Valid; import lombok.RequiredArgsConstructor; -import org.springframework.http.HttpHeaders; -import org.springframework.http.ResponseCookie; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; @@ -31,21 +28,6 @@ public ResponseEntity authWithGithub( public ResponseEntity logout( HttpServletRequest httpRequest ) { - HttpSession session = httpRequest.getSession(false); - if(session != null) { - session.invalidate(); - } - - ResponseCookie cookie = ResponseCookie.from("JSESSIONID", "") - .path("/") - .maxAge(0) - .secure(true) - .httpOnly(true) - .build(); - - return ResponseEntity - .noContent() - .header(HttpHeaders.SET_COOKIE, cookie.toString()) - .build(); + return ResponseEntity.noContent().build(); } } diff --git a/backend/src/test/java/reviewme/api/AuthApiTest.java b/backend/src/test/java/reviewme/api/AuthApiTest.java index 8e036b167..3bf6c61c9 100644 --- a/backend/src/test/java/reviewme/api/AuthApiTest.java +++ b/backend/src/test/java/reviewme/api/AuthApiTest.java @@ -1,6 +1,5 @@ package reviewme.api; -import static org.hamcrest.Matchers.containsString; import static org.springframework.restdocs.cookies.CookieDocumentation.cookieWithName; import static org.springframework.restdocs.cookies.CookieDocumentation.requestCookies; import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.document; @@ -55,7 +54,6 @@ public class AuthApiTest extends ApiTest { .when().post("/v2/auth/logout") .then().log().all() .apply(handler) - .statusCode(204) - .header("Set-Cookie", containsString("JSESSIONID=; Path=/; Max-Age=0")); + .statusCode(204); } }