diff --git a/application/src/main/java/org/depromeet/spot/application/common/jwt/JwtAuthenticationFilter.java b/application/src/main/java/org/depromeet/spot/application/common/jwt/JwtAuthenticationFilter.java index fed63a9e..8f8e45c2 100644 --- a/application/src/main/java/org/depromeet/spot/application/common/jwt/JwtAuthenticationFilter.java +++ b/application/src/main/java/org/depromeet/spot/application/common/jwt/JwtAuthenticationFilter.java @@ -94,8 +94,6 @@ protected void doFilterInternal( } private boolean checkMethodWhitelist(String requestURI, String requestMethod) { - log.info("requestURI: {}", requestURI); - log.info("requestMethod: {}", requestMethod); if (Arrays.stream(AUTH_WHITELIST).anyMatch(requestURI::startsWith)) { return true; } diff --git a/infrastructure/src/main/java/org/depromeet/spot/infrastructure/aws/property/ObjectStorageProperties.java b/infrastructure/src/main/java/org/depromeet/spot/infrastructure/aws/property/ObjectStorageProperties.java index 19dd0d5b..a8bb970a 100644 --- a/infrastructure/src/main/java/org/depromeet/spot/infrastructure/aws/property/ObjectStorageProperties.java +++ b/infrastructure/src/main/java/org/depromeet/spot/infrastructure/aws/property/ObjectStorageProperties.java @@ -3,4 +3,5 @@ import org.springframework.boot.context.properties.ConfigurationProperties; @ConfigurationProperties(prefix = "aws.s3") -public record ObjectStorageProperties(String accessKey, String secretKey, String bucketName) {} +public record ObjectStorageProperties( + String accessKey, String secretKey, String bucketName, String basicProfileImageUrl) {} diff --git a/infrastructure/src/main/java/org/depromeet/spot/infrastructure/jpa/oauth/OauthRepositoryImpl.java b/infrastructure/src/main/java/org/depromeet/spot/infrastructure/jpa/oauth/OauthRepositoryImpl.java index 628ef0de..a4d1bba7 100644 --- a/infrastructure/src/main/java/org/depromeet/spot/infrastructure/jpa/oauth/OauthRepositoryImpl.java +++ b/infrastructure/src/main/java/org/depromeet/spot/infrastructure/jpa/oauth/OauthRepositoryImpl.java @@ -4,6 +4,7 @@ import org.depromeet.spot.common.exception.oauth.OauthException.InvalidAcessTokenException; import org.depromeet.spot.domain.member.Member; import org.depromeet.spot.domain.member.enums.SnsProvider; +import org.depromeet.spot.infrastructure.aws.property.ObjectStorageProperties; import org.depromeet.spot.infrastructure.jpa.oauth.config.OauthProperties; import org.depromeet.spot.infrastructure.jpa.oauth.entity.GoogleTokenEntity; import org.depromeet.spot.infrastructure.jpa.oauth.entity.GoogleUserInfoEntity; @@ -28,6 +29,8 @@ public class OauthRepositoryImpl implements OauthRepository { private final String BEARER = "Bearer"; private final OauthProperties properties; + private final ObjectStorageProperties objectStorageProperties; + private final String AUTHORIZATION_CODE = "authorization_code"; @Override @@ -136,18 +139,21 @@ public String getOauthAccessToken(SnsProvider snsProvider, String authorizationC @Override public Member getKakaoRegisterUserInfo(String accessToken, Member member) { KakaoUserInfoEntity userInfo = getKakaoUserInfo(accessToken); + log.info("basicProfileImage : {}", objectStorageProperties.basicProfileImageUrl()); // 회원가입 시 받은 정보를 바탕으로 member로 변환해서 리턴. - return userInfo.toKakaoDomain(member); + return userInfo.toKakaoDomain(member, objectStorageProperties.basicProfileImageUrl()); } @Override public Member getOauthRegisterUserInfo(String accessToken, Member member) { switch (member.getSnsProvider()) { case KAKAO: - return getKakaoUserInfo(accessToken).toKakaoDomain(member); + return getKakaoUserInfo(accessToken) + .toKakaoDomain(member, objectStorageProperties.basicProfileImageUrl()); default: - return getGoogleUserInfo(accessToken).toGoogleDomain(member); + return getGoogleUserInfo(accessToken) + .toGoogleDomain(member, objectStorageProperties.basicProfileImageUrl()); } } diff --git a/infrastructure/src/main/java/org/depromeet/spot/infrastructure/jpa/oauth/entity/GoogleUserInfoEntity.java b/infrastructure/src/main/java/org/depromeet/spot/infrastructure/jpa/oauth/entity/GoogleUserInfoEntity.java index 07d2b20d..dc0454db 100644 --- a/infrastructure/src/main/java/org/depromeet/spot/infrastructure/jpa/oauth/entity/GoogleUserInfoEntity.java +++ b/infrastructure/src/main/java/org/depromeet/spot/infrastructure/jpa/oauth/entity/GoogleUserInfoEntity.java @@ -4,7 +4,6 @@ import org.depromeet.spot.domain.member.enums.MemberRole; import org.depromeet.spot.domain.member.enums.SnsProvider; import org.depromeet.spot.infrastructure.jpa.common.entity.BaseEntity; -import org.springframework.beans.factory.annotation.Value; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; @@ -17,9 +16,6 @@ @JsonIgnoreProperties(ignoreUnknown = true) public class GoogleUserInfoEntity extends BaseEntity { - @Value("${aws.s3.basicProfileImageUrl}") - private String BASIC_PROFILE_IMAGE_URL; - // 구글 로그인은 sub라는 이름으로 id값을 줌. // 구글의 sub 값은 Long 타입을 넘어감. // BigInteger로 처리하거나 String으로 처리해야함. @@ -38,11 +34,11 @@ public class GoogleUserInfoEntity extends BaseEntity { @JsonProperty("picture") public String profileImageUrl; - public Member toGoogleDomain(Member member) { + public Member toGoogleDomain(Member member, String basicProfileImageUrl) { return Member.builder() .email(email) .nickname(member.getNickname()) - .profileImage(BASIC_PROFILE_IMAGE_URL) + .profileImage(basicProfileImageUrl) .snsProvider(SnsProvider.GOOGLE) .idToken(idToken) .role(MemberRole.ROLE_USER) diff --git a/infrastructure/src/main/java/org/depromeet/spot/infrastructure/jpa/oauth/entity/KakaoUserInfoEntity.java b/infrastructure/src/main/java/org/depromeet/spot/infrastructure/jpa/oauth/entity/KakaoUserInfoEntity.java index 1708a1d1..9cb76298 100644 --- a/infrastructure/src/main/java/org/depromeet/spot/infrastructure/jpa/oauth/entity/KakaoUserInfoEntity.java +++ b/infrastructure/src/main/java/org/depromeet/spot/infrastructure/jpa/oauth/entity/KakaoUserInfoEntity.java @@ -8,7 +8,6 @@ import org.depromeet.spot.domain.member.enums.MemberRole; import org.depromeet.spot.domain.member.enums.SnsProvider; import org.depromeet.spot.infrastructure.jpa.common.entity.BaseEntity; -import org.springframework.beans.factory.annotation.Value; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; @@ -16,15 +15,14 @@ import lombok.Getter; import lombok.NoArgsConstructor; import lombok.ToString; +import lombok.extern.slf4j.Slf4j; +@Slf4j @Getter @NoArgsConstructor // 역직렬화를 위한 기본 생성자 @JsonIgnoreProperties(ignoreUnknown = true) public class KakaoUserInfoEntity extends BaseEntity { - @Value("${aws.s3.basicProfileImageUrl}") - private String BASIC_PROFILE_IMAGE_URL; - // 서비스에 연결 완료된 시각. UTC @JsonProperty("connected_at") public Date connectedAt; @@ -98,13 +96,13 @@ public class Profile { } } - public Member toKakaoDomain(Member member) { + public Member toKakaoDomain(Member member, String basicProfileImageUrl) { return Member.builder() .email(kakaoAccount.email) .name(kakaoAccount.name) .nickname(member.getNickname()) .phoneNumber(kakaoAccount.phoneNumber) - .profileImage(BASIC_PROFILE_IMAGE_URL) + .profileImage(basicProfileImageUrl) .snsProvider(SnsProvider.KAKAO) .idToken(getId().toString()) .role(MemberRole.ROLE_USER) diff --git a/infrastructure/src/test/java/org/depromeet/spot/infrastructure/aws/PresignedUrlGeneratorTest.java b/infrastructure/src/test/java/org/depromeet/spot/infrastructure/aws/PresignedUrlGeneratorTest.java index 54d78461..df095fb3 100644 --- a/infrastructure/src/test/java/org/depromeet/spot/infrastructure/aws/PresignedUrlGeneratorTest.java +++ b/infrastructure/src/test/java/org/depromeet/spot/infrastructure/aws/PresignedUrlGeneratorTest.java @@ -20,7 +20,8 @@ class PresignedUrlGeneratorTest { @BeforeEach void init() { ObjectStorageProperties objectStorageProperties = - new ObjectStorageProperties("accessKey", "secretKey", "bucketName"); + new ObjectStorageProperties( + "accessKey", "secretKey", "bucketName", "basicProfileImageUrl"); FakeAmazonS3Config amazonS3 = new FakeAmazonS3Config(objectStorageProperties); FakeTimeUsecase fakeTimeUsecase = new FakeTimeUsecase("2024-07-09 21:00:00");