diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index d23e8ade..5ec207eb 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -8,19 +8,19 @@ permissions: contents: read env: - DATASOURCE_URL : ${{ secrets.ENV_DATASOURCE_URL }} - DATASOURCE_USERNAME : ${{ secrets.ENV_DATASOURCE_USERNAME }} - DATASOURCE_PASSWORD : ${{ secrets.ENV_DATASOURCE_PASSWORD }} - GOOGLE_CLIENT_ID : ${{ secrets.ENV_GOOGLE_CLIENT_ID }} - GOOGLE_CLIENT_SECRET: ${{ secrets.ENV_GOOGLE_CLIENT_SECRET }} - GOOGLE_REDIRECT_URI : ${{ secrets.ENV_GOOGLE_REDIRECT_URI }} - IMAGE_UPLOAD_PATH : ${{ secrets.ENV_IMAGE_UPLOAD_PATH }} - JWT_SECRET : ${{ secrets.ENV_JWT_SECRET }} - KAKAO_CLIENT_ID : ${{ secrets.ENV_KAKAO_CLIENT_ID }} - KAKAO_CLIENT_SECRET : ${{ secrets.ENV_KAKAO_CLIENT_SECRET }} - KAKAO_REDIRECT_URI : ${{ secrets.ENV_KAKAO_REDIRECT_URI }} - KAKAOPAY_SECRET_KEY : ${{ secrets.ENV_KAKAOPAY_SECRET_KEY }} - SERVER_DOMAIN_NAME : ${{ secrets.ENV_SERVER_DOMAIN_NAME }} + DATASOURCE_URL : ${{ secrets.ENV_DATASOURCE_URL }} + DATASOURCE_USERNAME : ${{ secrets.ENV_DATASOURCE_USERNAME }} + DATASOURCE_PASSWORD : ${{ secrets.ENV_DATASOURCE_PASSWORD }} + GOOGLE_CLIENT_ID : ${{ secrets.ENV_GOOGLE_CLIENT_ID }} + GOOGLE_CLIENT_SECRET : ${{ secrets.ENV_GOOGLE_CLIENT_SECRET }} + GOOGLE_REDIRECT_DEEPLINK: ${{ secrets.ENV_GOOGLE_REDIRECT_DEEPLINK }} + IMAGE_UPLOAD_PATH : ${{ secrets.ENV_IMAGE_UPLOAD_PATH }} + JWT_SECRET : ${{ secrets.ENV_JWT_SECRET }} + KAKAO_CLIENT_ID : ${{ secrets.ENV_KAKAO_CLIENT_ID }} + KAKAO_CLIENT_SECRET : ${{ secrets.ENV_KAKAO_CLIENT_SECRET }} + KAKAO_REDIRECT_DEEPLINK : ${{ secrets.ENV_KAKAO_REDIRECT_DEEPLINK }} + KAKAOPAY_SECRET_KEY : ${{ secrets.ENV_KAKAOPAY_SECRET_KEY }} + SERVER_DOMAIN_NAME : ${{ secrets.ENV_SERVER_DOMAIN_NAME }} jobs: ## 1단계: 프로젝트 빌드 @@ -109,12 +109,12 @@ jobs: echo "DATASOURCE_PASSWORD=${{ secrets.ENV_DATASOURCE_PASSWORD }}" >> ~/.env echo "GOOGLE_CLIENT_ID=${{ secrets.ENV_GOOGLE_CLIENT_ID }}" >> ~/.env echo "GOOGLE_CLIENT_SECRET=${{ secrets.ENV_GOOGLE_CLIENT_SECRET }}" >> ~/.env - echo "GOOGLE_REDIRECT_URI=${{ secrets.ENV_GOOGLE_REDIRECT_URI }}" >> ~/.env + echo "GOOGLE_REDIRECT_DEEPLINK=${{ secrets.ENV_GOOGLE_REDIRECT_DEEPLINK }}" >> ~/.env echo "JWT_SECRET=${{ secrets.ENV_JWT_SECRET }}" >> ~/.env echo "IMAGE_UPLOAD_PATH=${{ secrets.ENV_IMAGE_UPLOAD_PATH }}" >> ~/.env echo "KAKAO_CLIENT_ID=${{ secrets.ENV_KAKAO_CLIENT_ID }}" >> ~/.env echo "KAKAO_CLIENT_SECRET=${{ secrets.ENV_KAKAO_CLIENT_SECRET }}" >> ~/.env - echo "KAKAO_REDIRECT_URI=${{ secrets.ENV_KAKAO_REDIRECT_URI }}" >> ~/.env + echo "KAKAO_REDIRECT_DEEPLINK=${{ secrets.ENV_KAKAO_REDIRECT_DEEPLINK }}" >> ~/.env echo "KAKAOPAY_SECRET_KEY=${{ secrets.ENV_KAKAOPAY_SECRET_KEY }}" >> ~/.env echo "SERVER_DOMAIN_NAME=${{ secrets.ENV_SERVER_DOMAIN_NAME }}" >> ~/.env echo "Environment setup has been completed." diff --git a/src/main/java/org/ktc2/cokaen/wouldyouin/auth/api/AuthRedirectController.java b/src/main/java/org/ktc2/cokaen/wouldyouin/auth/api/AuthRedirectController.java index 8c417070..db600cbe 100644 --- a/src/main/java/org/ktc2/cokaen/wouldyouin/auth/api/AuthRedirectController.java +++ b/src/main/java/org/ktc2/cokaen/wouldyouin/auth/api/AuthRedirectController.java @@ -1,36 +1,32 @@ package org.ktc2.cokaen.wouldyouin.auth.api; import lombok.extern.slf4j.Slf4j; -import org.ktc2.cokaen.wouldyouin._common.api.ApiResponse; -import org.ktc2.cokaen.wouldyouin._common.api.ApiResponseBody; import org.ktc2.cokaen.wouldyouin._common.exception.BusinessException; import org.ktc2.cokaen.wouldyouin._common.exception.ErrorCode; import org.ktc2.cokaen.wouldyouin.member.persist.AccountType; import org.springframework.beans.factory.annotation.Value; -import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; //@RestController @Slf4j @Controller public class AuthRedirectController { - @Value("${oauth.kakao.redirect_uri}") - private String kakaoRedirectUri; + @Value("${oauth.kakao.redirect.deeplink}") + private String kakaoRedirectDeeplink; - @Value("${oauth.google.redirect_uri}") - private String googleRedirectUri; + @Value("${oauth.google.redirect.deeplink}") + private String googleRedirectDeeplink; - private String getRedirectUri(AccountType accountType) { + private String getRedirectDeeplink(AccountType accountType) { switch(accountType) { case kakao: - return kakaoRedirectUri; + return kakaoRedirectDeeplink; case google: - return googleRedirectUri; + return googleRedirectDeeplink; default: throw new BusinessException("Invalid account type: " + accountType, ErrorCode.UNEXPECTED); } @@ -38,7 +34,7 @@ private String getRedirectUri(AccountType accountType) { @GetMapping("/auth/redirect/social/{accountType}") public String/*ResponseEntity>*/ redirect(@PathVariable("accountType")AccountType accountType, @RequestParam("code") String code) { - String redirectDeeplink = "redirect:" + getRedirectUri(accountType) + "?code=" + code; + String redirectDeeplink = "redirect:" + getRedirectDeeplink(accountType) + "?code=" + code; log.debug("#### redirectDeeplink = {}", redirectDeeplink); return redirectDeeplink; // return ApiResponse.ok("redirect:" + getRedirectUri(accountType) + "?code=" + code); diff --git a/src/main/java/org/ktc2/cokaen/wouldyouin/auth/application/oauth/GoogleRequestService.java b/src/main/java/org/ktc2/cokaen/wouldyouin/auth/application/oauth/GoogleRequestService.java index bade50ee..d9c6f3c7 100644 --- a/src/main/java/org/ktc2/cokaen/wouldyouin/auth/application/oauth/GoogleRequestService.java +++ b/src/main/java/org/ktc2/cokaen/wouldyouin/auth/application/oauth/GoogleRequestService.java @@ -42,7 +42,7 @@ public class GoogleRequestService extends OauthRequestService { @Value("${oauth.google.client.secret}") private String clientSecret; - @Value("${oauth.google.redirect_uri}") + @Value("${oauth.google.redirect.uri}") private String redirectUri; private final RestClientUtil client; diff --git a/src/main/java/org/ktc2/cokaen/wouldyouin/auth/application/oauth/KakaoRequestService.java b/src/main/java/org/ktc2/cokaen/wouldyouin/auth/application/oauth/KakaoRequestService.java index f92a690d..873d3906 100644 --- a/src/main/java/org/ktc2/cokaen/wouldyouin/auth/application/oauth/KakaoRequestService.java +++ b/src/main/java/org/ktc2/cokaen/wouldyouin/auth/application/oauth/KakaoRequestService.java @@ -45,7 +45,7 @@ public class KakaoRequestService extends OauthRequestService { @Value("${oauth.kakao.client.secret}") private String clientSecret; - @Value("${oauth.kakao.redirect_uri}") + @Value("${oauth.kakao.redirect.uri}") private String redirectUri; @Override diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 9ea7d046..07e40af7 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -76,7 +76,9 @@ oauth: client: id: ${KAKAO_CLIENT_ID} secret: ${KAKAO_CLIENT_SECRET} - redirect_uri: ${KAKAO_REDIRECT_URI} + redirect: + uri: ${SERVER_DOMAIN_NAME}/auth/redirect/social/kakao + deeplink: ${KAKAO_REDIRECT_DEEPLINK} google: uri: login: @@ -88,7 +90,9 @@ oauth: client: id: ${GOOGLE_CLIENT_ID} secret: ${GOOGLE_CLIENT_SECRET} - redirect_uri: ${GOOGLE_REDIRECT_URI} + redirect: + uri: ${SERVER_DOMAIN_NAME}/auth/redirect/social/google + deeplink: ${GOOGLE_REDIRECT_DEEPLINK} scope: - email - profile