From 4e2bd7c68a6d95021235e5de6776499a3112beb1 Mon Sep 17 00:00:00 2001 From: jinnieusLab Date: Fri, 10 Jul 2026 18:53:17 +0900 Subject: [PATCH 1/2] =?UTF-8?q?:recycle:=20refactor:=20Google=20Ads=20OAut?= =?UTF-8?q?h=20=EB=A1=9C=EA=B7=B8=EC=9D=B8=20=EC=84=B1=EA=B3=B5=20?= =?UTF-8?q?=EC=8B=9C=20=EC=83=81=ED=83=9C=EC=BD=94=EB=93=9C=20=EB=B0=8F=20?= =?UTF-8?q?=EC=9D=91=EB=8B=B5=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../presentation/GoogleAdOAuthController.java | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/whereyouad/WhereYouAd/domains/advertisement/presentation/GoogleAdOAuthController.java b/src/main/java/com/whereyouad/WhereYouAd/domains/advertisement/presentation/GoogleAdOAuthController.java index 135ccc11..f847a35b 100644 --- a/src/main/java/com/whereyouad/WhereYouAd/domains/advertisement/presentation/GoogleAdOAuthController.java +++ b/src/main/java/com/whereyouad/WhereYouAd/domains/advertisement/presentation/GoogleAdOAuthController.java @@ -12,11 +12,12 @@ import org.springframework.security.core.annotation.AuthenticationPrincipal; import org.springframework.web.bind.annotation.*; -import jakarta.servlet.http.HttpServletResponse; import org.springframework.web.util.UriComponentsBuilder; +import com.whereyouad.WhereYouAd.global.response.DataResponse; import java.io.IOException; import java.net.URI; +import java.util.Map; import java.util.UUID; @RestController @@ -42,8 +43,7 @@ public class GoogleAdOAuthController implements GoogleAdOAuthDocs { // 구글 연동 로그인 화면으로 리다이렉트 @GetMapping("/login") - public ResponseEntity redirectToGoogleAuth(@RequestParam("orgId") Long orgId, @AuthenticationPrincipal(expression = "userId") Long userId, - HttpServletResponse response) throws IOException { + public ResponseEntity>> redirectToGoogleAuth(@RequestParam("orgId") Long orgId, @AuthenticationPrincipal(expression = "userId") Long userId) { String stateToken = UUID.randomUUID().toString(); String rawState = userId + "_" + orgId; @@ -59,12 +59,7 @@ public ResponseEntity redirectToGoogleAuth(@RequestParam("orgId") Long org "&prompt=consent" + "&state=" + stateToken; - URI location = URI.create(authUrl); - - return ResponseEntity - .status(HttpStatus.FOUND) - .location(location) - .build(); + return ResponseEntity.ok(DataResponse.from(Map.of("redirectUrl", authUrl))); } @GetMapping("/callback") From 9208c0c5a46daade6b93995afc45e7d787cf5b34 Mon Sep 17 00:00:00 2001 From: jinnieusLab Date: Fri, 10 Jul 2026 18:53:44 +0900 Subject: [PATCH 2/2] =?UTF-8?q?:memo:=20docs:=20Google=20Ads=20OAuth=20?= =?UTF-8?q?=EB=A1=9C=EA=B7=B8=EC=9D=B8=20Swagger=20=EB=AA=85=EC=84=B8=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../advertisement/presentation/docs/GoogleAdOAuthDocs.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/whereyouad/WhereYouAd/domains/advertisement/presentation/docs/GoogleAdOAuthDocs.java b/src/main/java/com/whereyouad/WhereYouAd/domains/advertisement/presentation/docs/GoogleAdOAuthDocs.java index 2fdf1b3d..0cf2fc6e 100644 --- a/src/main/java/com/whereyouad/WhereYouAd/domains/advertisement/presentation/docs/GoogleAdOAuthDocs.java +++ b/src/main/java/com/whereyouad/WhereYouAd/domains/advertisement/presentation/docs/GoogleAdOAuthDocs.java @@ -10,6 +10,7 @@ import org.springframework.web.bind.annotation.RequestParam; import java.io.IOException; +import java.util.Map; public interface GoogleAdOAuthDocs { @@ -19,9 +20,8 @@ public interface GoogleAdOAuthDocs { "인증이 완료되면 사전에 등록된 콜백(callback) URI로 인증 코드(code)와 상태 값(state)이 반환됩니다." ) @GetMapping("/login") - ResponseEntity redirectToGoogleAuth(@Parameter @RequestParam("orgId") Long orgId, - @Parameter(hidden = true) @AuthenticationPrincipal(expression = "userId") Long userId, - HttpServletResponse response) throws IOException; + ResponseEntity>> redirectToGoogleAuth(@Parameter @RequestParam("orgId") Long orgId, + @Parameter(hidden = true) @AuthenticationPrincipal(expression = "userId") Long userId); @Operation( summary = "구글 OAuth 인증 콜백 및 리프레시 토큰 발급",