From 0b85320ec161d6e8c1aed2e3c834cbfca84fda3d Mon Sep 17 00:00:00 2001 From: rlawngjs0313 Date: Tue, 5 Aug 2025 02:34:53 +0900 Subject: [PATCH 01/99] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20refactor:=20Slack=20?= =?UTF-8?q?connect=20=EC=9D=91=EB=8B=B5=20=ED=98=95=EC=8B=9D=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Veco/domain/slack/controller/SlackController.java | 5 ++--- .../Veco/domain/slack/service/SlackCommandService.java | 9 ++------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/example/Veco/domain/slack/controller/SlackController.java b/src/main/java/com/example/Veco/domain/slack/controller/SlackController.java index ee83e157..38eb2566 100644 --- a/src/main/java/com/example/Veco/domain/slack/controller/SlackController.java +++ b/src/main/java/com/example/Veco/domain/slack/controller/SlackController.java @@ -10,7 +10,6 @@ import io.swagger.v3.oas.annotations.tags.Tag; import lombok.RequiredArgsConstructor; import org.springframework.web.bind.annotation.*; -import org.springframework.web.servlet.view.RedirectView; @RestController @RequiredArgsConstructor @@ -29,11 +28,11 @@ public class SlackController { "요청이 오면 Slack OAuth 화면으로 리다이렉트되는 방식입니다." ) @GetMapping("/connect") - public RedirectView slackConnect( + public ApiResponse slackConnect( @RequestHeader("Authorization") @Parameter(hidden = true) String token ){ - return slackCommandService.redirectSlackOAuth(token); + return ApiResponse.onSuccess(slackCommandService.redirectSlackOAuth(token)); } // Slack Callback: 비즈니스 로직 시작 지점 diff --git a/src/main/java/com/example/Veco/domain/slack/service/SlackCommandService.java b/src/main/java/com/example/Veco/domain/slack/service/SlackCommandService.java index 50f3c474..a69f9c30 100644 --- a/src/main/java/com/example/Veco/domain/slack/service/SlackCommandService.java +++ b/src/main/java/com/example/Veco/domain/slack/service/SlackCommandService.java @@ -23,7 +23,6 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import org.springframework.web.servlet.view.RedirectView; import java.time.LocalDateTime; import java.util.Objects; @@ -50,20 +49,16 @@ public class SlackCommandService { private String scope; // 리다이렉트 링크 생성 - public RedirectView redirectSlackOAuth( + public String redirectSlackOAuth( String token ){ // 토큰 Bearer 제거 token = token.replace("Bearer ", ""); - String url = "https://slack.com/oauth/v2/authorize?" + + return "https://slack.com/oauth/v2/authorize?" + "client_id="+clientId+ "&scope="+scope+ "&state="+token; - - RedirectView redirectView = new RedirectView(); - redirectView.setUrl(url); - return redirectView; } // Slack 연동 비즈니스 로직 From 7af2e18a5eb4c732f6fc10be663496d339842047 Mon Sep 17 00:00:00 2001 From: rlawngjs0313 Date: Tue, 5 Aug 2025 02:35:51 +0900 Subject: [PATCH 02/99] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20refactor:=20?= =?UTF-8?q?=EA=B0=9C=EB=B0=9C=20=ED=99=98=EA=B2=BD=EC=97=90=20=EB=A7=9E?= =?UTF-8?q?=EC=B6=B0,=20web.vecoservice.shop=20->=20localhost:5173=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../global/auth/oauth2/handler/OAuth2SuccessHandler.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/example/Veco/global/auth/oauth2/handler/OAuth2SuccessHandler.java b/src/main/java/com/example/Veco/global/auth/oauth2/handler/OAuth2SuccessHandler.java index 428717e0..03ae15df 100644 --- a/src/main/java/com/example/Veco/global/auth/oauth2/handler/OAuth2SuccessHandler.java +++ b/src/main/java/com/example/Veco/global/auth/oauth2/handler/OAuth2SuccessHandler.java @@ -73,13 +73,13 @@ public void onAuthenticationSuccess(HttpServletRequest request, HttpServletRespo if (userDetails.getMember().getWorkSpace() == null) { // 워크스페이스 생성 if (flow.equals("create")) { - redirectURL = UriComponentsBuilder.fromUriString("https://web.vecoservice.shop/onboarding/workspace") + redirectURL = UriComponentsBuilder.fromUriString("http://localhost:5173/onboarding/workspace") .build() .encode(StandardCharsets.UTF_8) .toUriString(); // 워크스페이스 참여 } else if (flow.equals("join")) { - redirectURL = UriComponentsBuilder.fromUriString("https://web.vecoservice.shop/onboarding/input-pw") + redirectURL = UriComponentsBuilder.fromUriString("http://localhost:5173/onboarding/input-pw") .build() .encode(StandardCharsets.UTF_8) .toUriString(); @@ -88,13 +88,13 @@ public void onAuthenticationSuccess(HttpServletRequest request, HttpServletRespo } // 기존 회원 } else { - redirectURL = UriComponentsBuilder.fromUriString("https://web.vecoservice.shop/workspace") + redirectURL = UriComponentsBuilder.fromUriString("http://localhost:5173/workspace") .build() .encode(StandardCharsets.UTF_8) .toUriString(); } -// redirectURL = UriComponentsBuilder.fromUriString("https://web.vecoservice.shop/onboarding/workspace") +// redirectURL = UriComponentsBuilder.fromUriString("http://localhost:5173/onboarding/workspace") // .build() // .encode(StandardCharsets.UTF_8) // .toUriString(); From 4ffdb5c6f44353c74ccd808b1758e6418d8f63bc Mon Sep 17 00:00:00 2001 From: sobinMoon Date: Tue, 5 Aug 2025 03:57:06 +0900 Subject: [PATCH 03/99] =?UTF-8?q?=E2=9C=A8=20feat:=20=EC=B9=B4=EC=B9=B4?= =?UTF-8?q?=EC=98=A4=20=EB=A1=9C=EA=B7=B8=EC=9D=B8=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../oauth2/userinfo/KakaoOAuth2UserInfo.java | 34 ++++++++++++++++++ .../global/auth/oauth2/util/OAuth2Util.java | 9 ++--- src/main/resources/static/login-test.html | 36 ++++++++++++++----- 3 files changed, 67 insertions(+), 12 deletions(-) create mode 100644 src/main/java/com/example/Veco/global/auth/oauth2/userinfo/KakaoOAuth2UserInfo.java diff --git a/src/main/java/com/example/Veco/global/auth/oauth2/userinfo/KakaoOAuth2UserInfo.java b/src/main/java/com/example/Veco/global/auth/oauth2/userinfo/KakaoOAuth2UserInfo.java new file mode 100644 index 00000000..294d80bb --- /dev/null +++ b/src/main/java/com/example/Veco/global/auth/oauth2/userinfo/KakaoOAuth2UserInfo.java @@ -0,0 +1,34 @@ +package com.example.Veco.global.auth.oauth2.userinfo; + +import java.util.Map; + +public class KakaoOAuth2UserInfo extends OAuth2UserInfo { + + public static Map account; + public static Map profile; + + public KakaoOAuth2UserInfo(Map attributes) { + super(attributes); + account = (Map) attributes.get("kakao_account"); + profile = (Map) account.get("profile"); + } + + @Override + public String getSocialId() { + return String.valueOf(attributes.get("id")); + } + + @Override + public String getEmail() { + return ""; + } // 카카오는 이메일 없음 + + @Override + public String getName() { + return (String) profile.get("nickname"); + } + @Override + public String getPicture() { + return (String) profile.get("thumbnail_image_url"); + } +} \ No newline at end of file diff --git a/src/main/java/com/example/Veco/global/auth/oauth2/util/OAuth2Util.java b/src/main/java/com/example/Veco/global/auth/oauth2/util/OAuth2Util.java index d21fbb27..d126b7ce 100644 --- a/src/main/java/com/example/Veco/global/auth/oauth2/util/OAuth2Util.java +++ b/src/main/java/com/example/Veco/global/auth/oauth2/util/OAuth2Util.java @@ -2,6 +2,7 @@ import com.example.Veco.domain.member.enums.Provider; import com.example.Veco.global.auth.oauth2.userinfo.GoogleOAuth2UserInfo; +import com.example.Veco.global.auth.oauth2.userinfo.KakaoOAuth2UserInfo; import com.example.Veco.global.auth.oauth2.userinfo.OAuth2UserInfo; import java.util.Map; @@ -15,8 +16,8 @@ public static Provider getProvider(String registrationId) { if ("GOOGLE".equals(registrationId)) { return Provider.GOOGLE; -// } else if ("KAKAO".equals(registrationId)) { -// return Provider.KAKAO; + } else if ("KAKAO".equals(registrationId)) { + return Provider.KAKAO; } return null; } @@ -25,8 +26,8 @@ public static OAuth2UserInfo getOAuth2UserInfo(Provider provider, Map

🔐 Google 로그인 테스트

- - - - - - +
+ + +
+ +
+ + +
+ +
+ + + + +