From b464edfdae0ef360dc010ca2d19a75d38e5c5b07 Mon Sep 17 00:00:00 2001 From: yang Date: Sat, 17 Aug 2024 23:41:26 +0900 Subject: [PATCH 1/2] =?UTF-8?q?RAC-422=20feat=20:=20=ED=86=A0=ED=81=B0=20?= =?UTF-8?q?=EA=B8=B0=EB=B0=98=20=EB=A1=9C=EA=B7=B8=EC=9D=B8=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../auth/application/dto/req/TokenRequest.java | 4 ++++ .../application/usecase/oauth/SignInUseCase.java | 3 +++ .../oauth/kakao/KakaoAccessTokenUseCase.java | 2 +- .../usecase/oauth/kakao/KakaoSignInUseCase.java | 13 ++++++++++++- .../domain/auth/presentation/AuthController.java | 11 +++++++++++ 5 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 src/main/java/com/postgraduate/domain/auth/application/dto/req/TokenRequest.java diff --git a/src/main/java/com/postgraduate/domain/auth/application/dto/req/TokenRequest.java b/src/main/java/com/postgraduate/domain/auth/application/dto/req/TokenRequest.java new file mode 100644 index 00000000..571a9019 --- /dev/null +++ b/src/main/java/com/postgraduate/domain/auth/application/dto/req/TokenRequest.java @@ -0,0 +1,4 @@ +package com.postgraduate.domain.auth.application.dto.req; + +public record TokenRequest(String accessToken) { +} diff --git a/src/main/java/com/postgraduate/domain/auth/application/usecase/oauth/SignInUseCase.java b/src/main/java/com/postgraduate/domain/auth/application/usecase/oauth/SignInUseCase.java index 5e31060e..08bd8552 100644 --- a/src/main/java/com/postgraduate/domain/auth/application/usecase/oauth/SignInUseCase.java +++ b/src/main/java/com/postgraduate/domain/auth/application/usecase/oauth/SignInUseCase.java @@ -1,10 +1,13 @@ package com.postgraduate.domain.auth.application.usecase.oauth; import com.postgraduate.domain.auth.application.dto.req.CodeRequest; +import com.postgraduate.domain.auth.application.dto.req.TokenRequest; import com.postgraduate.domain.auth.application.dto.res.AuthUserResponse; public interface SignInUseCase { AuthUserResponse getUser(CodeRequest request); AuthUserResponse getDevUser(CodeRequest codeRequest); + + AuthUserResponse getUserWithToken(TokenRequest request); } \ No newline at end of file diff --git a/src/main/java/com/postgraduate/domain/auth/application/usecase/oauth/kakao/KakaoAccessTokenUseCase.java b/src/main/java/com/postgraduate/domain/auth/application/usecase/oauth/kakao/KakaoAccessTokenUseCase.java index 2e4165b6..cfdb3096 100644 --- a/src/main/java/com/postgraduate/domain/auth/application/usecase/oauth/kakao/KakaoAccessTokenUseCase.java +++ b/src/main/java/com/postgraduate/domain/auth/application/usecase/oauth/kakao/KakaoAccessTokenUseCase.java @@ -78,7 +78,7 @@ private KakaoUserInfoResponse getKakaoUserInfoResponse(MultiValueMap> authLoginWithToken(@RequestBody @Valid TokenRequest request, @PathVariable Provider provider) { + SignInUseCase signInUseCase = selectOauth.selectSignIn(provider); + AuthUserResponse authUser = signInUseCase.getUserWithToken(request); + if (authUser.user() == null) + return ResponseEntity.ok(create(AUTH_NONE.getCode(), NOT_REGISTERED_USER.getMessage(), authUser)); + JwtTokenResponse jwtToken = jwtUseCase.signIn(authUser.user()); + return ResponseEntity.ok(create(AUTH_ALREADY.getCode(), SUCCESS_AUTH.getMessage(), jwtToken)); + } + @PostMapping("/login/{provider}") @Operation(summary = "소셜 로그인", description = "회원인 경우 JWT를, 회원이 아닌 경우 socialId를 반환합니다(회원가입은 진행하지 않습니다).") public ResponseEntity> authLogin(@RequestBody @Valid CodeRequest request, @PathVariable Provider provider) { From a8b62557452b0d36919d8b60519e444062c3455f Mon Sep 17 00:00:00 2001 From: yang Date: Sat, 17 Aug 2024 23:41:45 +0900 Subject: [PATCH 2/2] =?UTF-8?q?RAC-422=20fix=20:=20=ED=85=8C=EC=8A=A4?= =?UTF-8?q?=ED=8A=B8=EC=8B=9C=20=EC=95=8C=EB=A6=BC=ED=86=A1=20=EC=A0=84?= =?UTF-8?q?=EC=86=A1=20=EC=A0=9C=EC=99=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../global/bizppurio/application/usecase/BizppurioSend.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/com/postgraduate/global/bizppurio/application/usecase/BizppurioSend.java b/src/main/java/com/postgraduate/global/bizppurio/application/usecase/BizppurioSend.java index 0fb1e695..b6a77634 100644 --- a/src/main/java/com/postgraduate/global/bizppurio/application/usecase/BizppurioSend.java +++ b/src/main/java/com/postgraduate/global/bizppurio/application/usecase/BizppurioSend.java @@ -22,11 +22,16 @@ public class BizppurioSend { private final ObjectMapper objectMapper; private final WebClient webClient; private final SlackErrorMessage slackErrorMessage; + private static final String DEV = "DEV"; @Value("${bizppurio.message}") private String messageUrl; + @Value("${bizppurio.status}") + private String status; protected void sendMessageWithExceptionHandling(Supplier messageSupplier) { + if (status.equals(DEV)) + return; try { CommonRequest commonRequest = messageSupplier.get(); String accessToken = bizppurioAuth.getAuth();