From 6ac56eb06cfceb34faae8135a789a8f9916d0948 Mon Sep 17 00:00:00 2001 From: kgy1008 Date: Mon, 8 Jul 2024 22:27:36 +0900 Subject: [PATCH] =?UTF-8?q?[refac]=20=EC=86=8C=EC=85=9C=EB=A1=9C=EA=B7=B8?= =?UTF-8?q?=EC=9D=B8=20=EC=BD=94=EB=93=9C=20=EB=A6=AC=ED=8E=99=ED=86=A0?= =?UTF-8?q?=EB=A7=81=20(#24)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [refac] apply code review * [refac] apply code review * [refac] apply code review --- server-yml | 2 +- .../hankkiserver/HankkiserverApplication.java | 2 - .../api/auth/controller/AuthController.java | 6 +- .../api/auth/service/AuthService.java | 142 +++++++----------- .../api/auth/service/UserFinder.java | 37 +++++ .../api/auth/service/UserInfoDeleter.java | 16 ++ .../api/auth/service/UserInfoFinder.java | 20 +++ .../api/auth/service/UserInfoSaver.java | 17 +++ .../api/auth/service/UserSaver.java | 17 +++ .../auth/UserIdArgumentResolver.java | 2 +- .../hankkiserver/auth/jwt/JwtProvider.java | 2 +- .../hankkiserver/domain/user/model/User.java | 16 +- .../domain/user/model/UserRole.java | 3 +- .../user/repository/UserInfoRepository.java | 1 - .../user/repository/UserRepository.java | 13 +- .../external/config/FeignConfig.java | 10 ++ .../openfeign/apple/AppleFeignClient.java | 2 +- .../openfeign/kakao/KakaoFeignClient.java | 2 +- 18 files changed, 191 insertions(+), 119 deletions(-) create mode 100644 src/main/java/org/hankki/hankkiserver/api/auth/service/UserFinder.java create mode 100644 src/main/java/org/hankki/hankkiserver/api/auth/service/UserInfoDeleter.java create mode 100644 src/main/java/org/hankki/hankkiserver/api/auth/service/UserInfoFinder.java create mode 100644 src/main/java/org/hankki/hankkiserver/api/auth/service/UserInfoSaver.java create mode 100644 src/main/java/org/hankki/hankkiserver/api/auth/service/UserSaver.java create mode 100644 src/main/java/org/hankki/hankkiserver/external/config/FeignConfig.java diff --git a/server-yml b/server-yml index a7d6b4d4..45868e19 160000 --- a/server-yml +++ b/server-yml @@ -1 +1 @@ -Subproject commit a7d6b4d403c4c09d3c0db99b1187d0d8bcc1f850 +Subproject commit 45868e19e645aa10b406f507135844a83503fe4b diff --git a/src/main/java/org/hankki/hankkiserver/HankkiserverApplication.java b/src/main/java/org/hankki/hankkiserver/HankkiserverApplication.java index 69b7594b..e299317c 100644 --- a/src/main/java/org/hankki/hankkiserver/HankkiserverApplication.java +++ b/src/main/java/org/hankki/hankkiserver/HankkiserverApplication.java @@ -2,10 +2,8 @@ import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.cloud.openfeign.EnableFeignClients; @SpringBootApplication -@EnableFeignClients public class HankkiserverApplication { public static void main(String[] args) { diff --git a/src/main/java/org/hankki/hankkiserver/api/auth/controller/AuthController.java b/src/main/java/org/hankki/hankkiserver/api/auth/controller/AuthController.java index 270fd521..7bf77a79 100644 --- a/src/main/java/org/hankki/hankkiserver/api/auth/controller/AuthController.java +++ b/src/main/java/org/hankki/hankkiserver/api/auth/controller/AuthController.java @@ -16,7 +16,7 @@ @RestController @RequiredArgsConstructor -@RequestMapping("api/v1") +@RequestMapping("/api/v1") public class AuthController { private final AuthService authService; @@ -46,8 +46,8 @@ public ResponseEntity> withdraw( @PostMapping("/auth/reissue") public ResponseEntity> reissue( - @RequestHeader(HttpHeaders.AUTHORIZATION) final String refreshtoken) { - final UserReissueResponse response = authService.reissue(refreshtoken); + @RequestHeader(HttpHeaders.AUTHORIZATION) final String refreshToken) { + final UserReissueResponse response = authService.reissue(refreshToken); return ApiResponse.success(SuccessCode.OK, response); } } diff --git a/src/main/java/org/hankki/hankkiserver/api/auth/service/AuthService.java b/src/main/java/org/hankki/hankkiserver/api/auth/service/AuthService.java index 86ec5ff8..81fa93b2 100644 --- a/src/main/java/org/hankki/hankkiserver/api/auth/service/AuthService.java +++ b/src/main/java/org/hankki/hankkiserver/api/auth/service/AuthService.java @@ -8,13 +8,10 @@ import org.hankki.hankkiserver.domain.user.model.User; import org.hankki.hankkiserver.domain.user.model.UserInfo; import org.hankki.hankkiserver.domain.user.model.Platform; -import org.hankki.hankkiserver.common.exception.EntityNotFoundException; import org.hankki.hankkiserver.common.exception.InvalidValueException; import org.hankki.hankkiserver.common.exception.UnauthorizedException; import org.hankki.hankkiserver.external.openfeign.apple.AppleOAuthProvider; import org.hankki.hankkiserver.external.openfeign.dto.SocialInfoDto; -import org.hankki.hankkiserver.domain.user.repository.UserInfoRepository; -import org.hankki.hankkiserver.domain.user.repository.UserRepository; import org.hankki.hankkiserver.api.auth.controller.request.UserLoginRequest; import org.hankki.hankkiserver.api.auth.service.response.UserLoginResponse; import org.hankki.hankkiserver.api.auth.service.response.UserReissueResponse; @@ -22,20 +19,24 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.util.Optional; + import static org.hankki.hankkiserver.domain.user.model.MemberStatus.ACTIVE; -import static org.hankki.hankkiserver.domain.user.model.MemberStatus.INACTIVE; -import static org.hankki.hankkiserver.domain.user.model.Platform.*; -import static org.hankki.hankkiserver.domain.user.model.User.createUser; -import static org.hankki.hankkiserver.domain.user.model.UserInfo.createMemberInfo; +import static org.hankki.hankkiserver.domain.user.model.Platform.APPLE; +import static org.hankki.hankkiserver.domain.user.model.Platform.KAKAO; import static org.hankki.hankkiserver.auth.filter.JwtAuthenticationFilter.BEARER; +import static org.hankki.hankkiserver.domain.user.model.User.createUser; @Service @Transactional @RequiredArgsConstructor public class AuthService { - private final UserRepository userRepository; - private final UserInfoRepository userInfoRepository; + private final UserFinder userFinder; + private final UserSaver userSaver; + private final UserInfoFinder userInfoFinder; + private final UserInfoSaver userInfoSaver; + private final UserInfoDeleter userInfoDeleter; private final JwtProvider jwtProvider; private final JwtValidator jwtValidator; private final KakaoOAuthProvider kakaoOAuthProvider; @@ -44,22 +45,22 @@ public class AuthService { public UserLoginResponse login( final String token, final UserLoginRequest request) { - Platform platform = getEnumPlatformFromStringPlatform(request.platform()); + Platform platform = Platform.getEnumPlatformFromStringPlatform(request.platform()); SocialInfoDto socialInfo = getSocialInfo(token, platform, request.name()); - boolean isRegistered = isRegisteredUser(platform, socialInfo); - User findUser = loadOrCreateUser(platform, socialInfo, isRegistered); + boolean isRegistered = userFinder.isRegisteredUser(platform, socialInfo); + User findUser = loadOrCreateUser(platform, socialInfo); Token issuedToken = generateTokens(findUser.getId()); return UserLoginResponse.of(issuedToken, isRegistered); } - public void logOut(final Long userId) { - UserInfo findUserInfo = getUserInfo(userId); - updateRefreshToken(null, findUserInfo); + public void logOut(final long userId) { + UserInfo findUserInfo = userInfoFinder.getUserInfo(userId); + findUserInfo.updateRefreshToken(null); } - public void withdraw(final Long userId, final String code) { - User user = getUser(userId); - if (user.getPlatform() == APPLE){ + public void withdraw(final long userId, final String code) { + User user = userFinder.getUser(userId); + if (APPLE == user.getPlatform()){ try { String refreshToken = appleOAuthProvider.getAppleToken(code); appleOAuthProvider.requestRevoke(refreshToken); @@ -67,27 +68,25 @@ public void withdraw(final Long userId, final String code) { throw new InvalidValueException(ErrorCode.APPLE_REVOKE_FAILED); } } - - userRepository.softDeleteById(userId, INACTIVE); - userInfoRepository.softDeleteByUserId(userId); - user.softDelete(INACTIVE); + user.softDelete(); + userInfoDeleter.softDelete(userId); } @Transactional(noRollbackFor = UnauthorizedException.class) public UserReissueResponse reissue(final String refreshToken) { - Long userId = jwtProvider.getSubject(refreshToken.substring(BEARER.length())); + long userId = jwtProvider.getSubject(refreshToken.substring(BEARER.length())); validateRefreshToken(refreshToken, userId); - UserInfo findUserInfo = getUserInfo(userId); - Token issueToken = jwtProvider.issueToken(userId); - updateRefreshToken(issueToken.refreshToken(), findUserInfo); - return UserReissueResponse.of(issueToken); + UserInfo findUserInfo = userInfoFinder.getUserInfo(userId); + Token issuedTokens = jwtProvider.issueTokens(userId); + findUserInfo.updateRefreshToken(issuedTokens.refreshToken()); + return UserReissueResponse.of(issuedTokens); } - private Token generateTokens(final Long userId) { - Token issuedToken = jwtProvider.issueToken(userId); - UserInfo findUserInfo = getUserInfo(userId); - updateRefreshToken(issuedToken.refreshToken(), findUserInfo); - return issuedToken; + private Token generateTokens(final long userId) { + Token issuedTokens = jwtProvider.issueTokens(userId); + UserInfo findUserInfo = userInfoFinder.getUserInfo(userId); + findUserInfo.updateRefreshToken(issuedTokens.refreshToken()); + return issuedTokens; } private SocialInfoDto getSocialInfo( @@ -96,76 +95,43 @@ private SocialInfoDto getSocialInfo( final String name) { if (KAKAO == platform){ return kakaoOAuthProvider.getKakaoUserInfo(providerToken); - } else if (APPLE == platform){ - return appleOAuthProvider.getAppleUserInfo(providerToken, name); } - throw new EntityNotFoundException(ErrorCode.INVALID_PLATFORM_TYPE); + return appleOAuthProvider.getAppleUserInfo(providerToken, name); } - private boolean isRegisteredUser(Platform platform, SocialInfoDto socialInfo){ - return userRepository.existsByPlatformAndSerialIdAndMemberStatus( - platform, - socialInfo.serialId(), - ACTIVE); + private User loadOrCreateUser(final Platform platform, final SocialInfoDto socialInfo) { + return userFinder.findUserByPlatFormAndSeralId(platform, socialInfo.serialId()) + .map(this::updateUserInfo) + .orElseGet(() -> { + User newUser = createUser( + socialInfo.name(), + socialInfo.email(), + socialInfo.serialId(), + platform); + saveUserAndUserInfo(newUser); + return newUser; + }); } - private User loadOrCreateUser(Platform platform, SocialInfoDto socialInfo, boolean isRegistered){ - if (!isRegistered){ - User newUser = createUser( - socialInfo.name(), - socialInfo.email(), - socialInfo.serialId(), - platform); - saveUser(newUser); - return newUser; - } - User findUser = getUser(platform, socialInfo.serialId()); - if (INACTIVE == findUser.getMemberStatus()) { - findUser.softDelete(ACTIVE); - userRepository.save(findUser); - } - return findUser; - } - - private User getUser( - final Platform platform, - final String serialId) { - return userRepository.findByPlatformAndSerialId(platform, serialId) - .orElseThrow(() -> new EntityNotFoundException(ErrorCode.USER_NOT_FOUND)); - } - - private User getUser(final Long userId) { - return userRepository.findById(userId) - .orElseThrow(() -> new EntityNotFoundException(ErrorCode.USER_NOT_FOUND)); - } - - private UserInfo getUserInfo(final Long memberId) { - return userInfoRepository.findByUserId(memberId) - .orElseThrow(() -> new EntityNotFoundException(ErrorCode.USER_INFO_NOT_FOUND)); + private User updateUserInfo(final User user) { + user.updateStatus(ACTIVE); + userInfoFinder.getUserInfo(user.getId()).updateNickname(user.getName()); + return user; } private String getRefreshToken(final Long userId) { - return userInfoRepository.findByUserId(userId) - .orElseThrow(() -> new EntityNotFoundException(ErrorCode.REFRESH_TOKEN_NOT_FOUND)) + return userInfoFinder.getUserInfo(userId) .getRefreshToken(); } - private void saveUser(final User user) { - userRepository.save(user); - UserInfo userInfo = createMemberInfo(user, null); - userInfoRepository.save(userInfo); - } - - private void updateRefreshToken( - final String refreshToken, - final UserInfo userInfo) { - userInfo.updateRefreshToken(refreshToken); + private void saveUserAndUserInfo(final User user) { + userSaver.saveUser(user); + UserInfo userInfo = UserInfo.createMemberInfo(user, null); + userInfoSaver.saveUserInfo(userInfo); } - private void validateRefreshToken( - final String refreshToken, - final Long userId) { + private void validateRefreshToken(final String refreshToken, final long userId) { try { jwtValidator.validateRefreshToken(refreshToken); String storedRefreshToken = getRefreshToken(userId); diff --git a/src/main/java/org/hankki/hankkiserver/api/auth/service/UserFinder.java b/src/main/java/org/hankki/hankkiserver/api/auth/service/UserFinder.java new file mode 100644 index 00000000..0d2b4320 --- /dev/null +++ b/src/main/java/org/hankki/hankkiserver/api/auth/service/UserFinder.java @@ -0,0 +1,37 @@ +package org.hankki.hankkiserver.api.auth.service; + +import lombok.RequiredArgsConstructor; +import org.hankki.hankkiserver.common.code.ErrorCode; +import org.hankki.hankkiserver.common.exception.EntityNotFoundException; +import org.hankki.hankkiserver.domain.user.model.Platform; +import org.hankki.hankkiserver.domain.user.model.User; +import org.hankki.hankkiserver.domain.user.repository.UserRepository; +import org.hankki.hankkiserver.external.openfeign.dto.SocialInfoDto; +import org.springframework.stereotype.Component; + +import java.util.Optional; + +import static org.hankki.hankkiserver.domain.user.model.MemberStatus.ACTIVE; + +@Component +@RequiredArgsConstructor +public class UserFinder { + + private final UserRepository userRepository; + + public User getUser(final long userId) { + return userRepository.findById(userId) + .orElseThrow(() -> new EntityNotFoundException(ErrorCode.USER_NOT_FOUND)); + } + + public boolean isRegisteredUser(final Platform platform, final SocialInfoDto socialInfo) { + return userRepository.existsByPlatformAndSerialIdAndMemberStatus( + platform, + socialInfo.serialId(), + ACTIVE); + } + + public Optional findUserByPlatFormAndSeralId(final Platform platform, final String serialId) { + return userRepository.findByPlatformAndSerialId(platform, serialId); + } +} diff --git a/src/main/java/org/hankki/hankkiserver/api/auth/service/UserInfoDeleter.java b/src/main/java/org/hankki/hankkiserver/api/auth/service/UserInfoDeleter.java new file mode 100644 index 00000000..4b46ef88 --- /dev/null +++ b/src/main/java/org/hankki/hankkiserver/api/auth/service/UserInfoDeleter.java @@ -0,0 +1,16 @@ +package org.hankki.hankkiserver.api.auth.service; + +import lombok.RequiredArgsConstructor; +import org.hankki.hankkiserver.domain.user.repository.UserInfoRepository; +import org.springframework.stereotype.Component; + +@Component +@RequiredArgsConstructor +public class UserInfoDeleter { + + private final UserInfoRepository userInfoRepository; + + public void softDelete(final long userId) { + userInfoRepository.softDeleteByUserId(userId); + } +} diff --git a/src/main/java/org/hankki/hankkiserver/api/auth/service/UserInfoFinder.java b/src/main/java/org/hankki/hankkiserver/api/auth/service/UserInfoFinder.java new file mode 100644 index 00000000..b34a1dd7 --- /dev/null +++ b/src/main/java/org/hankki/hankkiserver/api/auth/service/UserInfoFinder.java @@ -0,0 +1,20 @@ +package org.hankki.hankkiserver.api.auth.service; + +import lombok.RequiredArgsConstructor; +import org.hankki.hankkiserver.common.code.ErrorCode; +import org.hankki.hankkiserver.common.exception.EntityNotFoundException; +import org.hankki.hankkiserver.domain.user.model.UserInfo; +import org.hankki.hankkiserver.domain.user.repository.UserInfoRepository; +import org.springframework.stereotype.Component; + +@Component +@RequiredArgsConstructor +public class UserInfoFinder { + + private final UserInfoRepository userInfoRepository; + + public UserInfo getUserInfo(final long userId) { + return userInfoRepository.findByUserId(userId) + .orElseThrow(() -> new EntityNotFoundException(ErrorCode.USER_INFO_NOT_FOUND)); + } +} diff --git a/src/main/java/org/hankki/hankkiserver/api/auth/service/UserInfoSaver.java b/src/main/java/org/hankki/hankkiserver/api/auth/service/UserInfoSaver.java new file mode 100644 index 00000000..dc0f0e77 --- /dev/null +++ b/src/main/java/org/hankki/hankkiserver/api/auth/service/UserInfoSaver.java @@ -0,0 +1,17 @@ +package org.hankki.hankkiserver.api.auth.service; + +import lombok.RequiredArgsConstructor; +import org.hankki.hankkiserver.domain.user.model.UserInfo; +import org.hankki.hankkiserver.domain.user.repository.UserInfoRepository; +import org.springframework.stereotype.Component; + +@Component +@RequiredArgsConstructor +public class UserInfoSaver { + + private final UserInfoRepository userInfoRepository; + + public void saveUserInfo(final UserInfo userInfo) { + userInfoRepository.save(userInfo); + } +} diff --git a/src/main/java/org/hankki/hankkiserver/api/auth/service/UserSaver.java b/src/main/java/org/hankki/hankkiserver/api/auth/service/UserSaver.java new file mode 100644 index 00000000..e6a51480 --- /dev/null +++ b/src/main/java/org/hankki/hankkiserver/api/auth/service/UserSaver.java @@ -0,0 +1,17 @@ +package org.hankki.hankkiserver.api.auth.service; + +import lombok.RequiredArgsConstructor; +import org.hankki.hankkiserver.domain.user.model.User; +import org.hankki.hankkiserver.domain.user.repository.UserRepository; +import org.springframework.stereotype.Component; + +@Component +@RequiredArgsConstructor +public class UserSaver { + + private final UserRepository userRepository; + + public void saveUser(final User user) { + userRepository.save(user); + } +} diff --git a/src/main/java/org/hankki/hankkiserver/auth/UserIdArgumentResolver.java b/src/main/java/org/hankki/hankkiserver/auth/UserIdArgumentResolver.java index c1c1103a..1dd34b42 100644 --- a/src/main/java/org/hankki/hankkiserver/auth/UserIdArgumentResolver.java +++ b/src/main/java/org/hankki/hankkiserver/auth/UserIdArgumentResolver.java @@ -14,7 +14,7 @@ public class UserIdArgumentResolver implements HandlerMethodArgumentResolver { @Override public boolean supportsParameter(MethodParameter parameter) { boolean hasUserIdAnnotation = parameter.hasParameterAnnotation(UserId.class); - boolean isLongType = Long.class.isAssignableFrom(parameter.getParameterType()); + boolean isLongType = parameter.getParameterType().equals(Long.class); return hasUserIdAnnotation && isLongType; } diff --git a/src/main/java/org/hankki/hankkiserver/auth/jwt/JwtProvider.java b/src/main/java/org/hankki/hankkiserver/auth/jwt/JwtProvider.java index df1cdee3..c304eba0 100644 --- a/src/main/java/org/hankki/hankkiserver/auth/jwt/JwtProvider.java +++ b/src/main/java/org/hankki/hankkiserver/auth/jwt/JwtProvider.java @@ -10,7 +10,7 @@ public class JwtProvider { private final JwtGenerator jwtGenerator; - public Token issueToken(Long userId) { + public Token issueTokens(Long userId) { return Token.of(jwtGenerator.generateToken(userId, true), jwtGenerator.generateToken(userId, false)); } diff --git a/src/main/java/org/hankki/hankkiserver/domain/user/model/User.java b/src/main/java/org/hankki/hankkiserver/domain/user/model/User.java index 73f01968..6bd76ae8 100644 --- a/src/main/java/org/hankki/hankkiserver/domain/user/model/User.java +++ b/src/main/java/org/hankki/hankkiserver/domain/user/model/User.java @@ -44,11 +44,7 @@ public class User extends BaseTimeEntity { @Enumerated(EnumType.STRING) private MemberStatus memberStatus; - public static User createUser( - final String name, - final String email, - final String serialId, - final Platform platform) { + public static User createUser(final String name, final String email, final String serialId, final Platform platform) { return User.builder() .name(name) .email(email) @@ -59,10 +55,12 @@ public static User createUser( .build(); } - public void softDelete(MemberStatus memberStatus) { + public void softDelete() { + updateStatus(INACTIVE); + this.deletedAt = LocalDateTime.now(); + } + + public void updateStatus(MemberStatus memberStatus) { this.memberStatus = memberStatus; - if (INACTIVE == memberStatus) { - this.deletedAt = LocalDateTime.now(); - } } } diff --git a/src/main/java/org/hankki/hankkiserver/domain/user/model/UserRole.java b/src/main/java/org/hankki/hankkiserver/domain/user/model/UserRole.java index 5e944f37..1a41a6ea 100644 --- a/src/main/java/org/hankki/hankkiserver/domain/user/model/UserRole.java +++ b/src/main/java/org/hankki/hankkiserver/domain/user/model/UserRole.java @@ -7,7 +7,8 @@ @RequiredArgsConstructor public enum UserRole { - ADMIN("ADMIN"), USER("USER"); + ADMIN("ADMIN"), + USER("USER"); private final String value; diff --git a/src/main/java/org/hankki/hankkiserver/domain/user/repository/UserInfoRepository.java b/src/main/java/org/hankki/hankkiserver/domain/user/repository/UserInfoRepository.java index c48be449..a238ea15 100644 --- a/src/main/java/org/hankki/hankkiserver/domain/user/repository/UserInfoRepository.java +++ b/src/main/java/org/hankki/hankkiserver/domain/user/repository/UserInfoRepository.java @@ -6,7 +6,6 @@ import org.springframework.data.jpa.repository.Modifying; import org.springframework.data.jpa.repository.Query; -import org.springframework.transaction.annotation.Transactional; import java.util.Optional; diff --git a/src/main/java/org/hankki/hankkiserver/domain/user/repository/UserRepository.java b/src/main/java/org/hankki/hankkiserver/domain/user/repository/UserRepository.java index edc67b79..31f1f77d 100644 --- a/src/main/java/org/hankki/hankkiserver/domain/user/repository/UserRepository.java +++ b/src/main/java/org/hankki/hankkiserver/domain/user/repository/UserRepository.java @@ -4,19 +4,12 @@ import org.hankki.hankkiserver.domain.user.model.Platform; import org.hankki.hankkiserver.domain.user.model.User; import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.data.jpa.repository.Modifying; -import org.springframework.data.jpa.repository.Query; -import org.springframework.data.repository.query.Param; -import org.springframework.transaction.annotation.Transactional; import java.util.Optional; public interface UserRepository extends JpaRepository { + Optional findByPlatformAndSerialId(Platform platform, String serialId); - boolean existsByPlatformAndSerialIdAndMemberStatus(Platform platform, String platformId, MemberStatus memberStatus); - Optional findByPlatformAndSerialId(Platform platform, String platformId); - - @Modifying - @Query("UPDATE User u SET u.memberStatus = :memberStatus WHERE u.id = :userId") - void softDeleteById(@Param("userId") Long userId, @Param("memberStatus") MemberStatus memberStatus); + boolean existsByPlatformAndSerialIdAndMemberStatus(Platform platform, String serialId, MemberStatus memberStatus); + Optional findByPlatformAndSerialIdAndMemberStatus(Platform platform, String serialId, MemberStatus memberStatus); } diff --git a/src/main/java/org/hankki/hankkiserver/external/config/FeignConfig.java b/src/main/java/org/hankki/hankkiserver/external/config/FeignConfig.java new file mode 100644 index 00000000..e033254a --- /dev/null +++ b/src/main/java/org/hankki/hankkiserver/external/config/FeignConfig.java @@ -0,0 +1,10 @@ +package org.hankki.hankkiserver.external.config; + +import org.hankki.hankkiserver.HankkiserverApplication; +import org.springframework.cloud.openfeign.EnableFeignClients; +import org.springframework.context.annotation.Configuration; + +@Configuration +@EnableFeignClients(basePackageClasses = HankkiserverApplication.class) +public class FeignConfig { +} diff --git a/src/main/java/org/hankki/hankkiserver/external/openfeign/apple/AppleFeignClient.java b/src/main/java/org/hankki/hankkiserver/external/openfeign/apple/AppleFeignClient.java index 42b392e4..6a30a224 100644 --- a/src/main/java/org/hankki/hankkiserver/external/openfeign/apple/AppleFeignClient.java +++ b/src/main/java/org/hankki/hankkiserver/external/openfeign/apple/AppleFeignClient.java @@ -8,7 +8,7 @@ import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; -@FeignClient(name = "${oauth.apple.name}", url = "${oauth.apple.url}") +@FeignClient(name = "appleClient", url = "https://appleid.apple.com/auth") public interface AppleFeignClient { @GetMapping("/keys") diff --git a/src/main/java/org/hankki/hankkiserver/external/openfeign/kakao/KakaoFeignClient.java b/src/main/java/org/hankki/hankkiserver/external/openfeign/kakao/KakaoFeignClient.java index 4d23897f..3b53f80a 100644 --- a/src/main/java/org/hankki/hankkiserver/external/openfeign/kakao/KakaoFeignClient.java +++ b/src/main/java/org/hankki/hankkiserver/external/openfeign/kakao/KakaoFeignClient.java @@ -6,7 +6,7 @@ import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestHeader; -@FeignClient(name = "${oauth.kakao.name}", url = "${oauth.kakao.url}") +@FeignClient(name = "kakaoClient", url = "https://kapi.kakao.com/v2/user/me") public interface KakaoFeignClient { @GetMapping