diff --git a/src/main/java/com/umc/refit/domain/dto/chat/OtherImage.java b/src/main/java/com/umc/refit/domain/dto/chat/OtherImage.java new file mode 100644 index 0000000..3fbeec0 --- /dev/null +++ b/src/main/java/com/umc/refit/domain/dto/chat/OtherImage.java @@ -0,0 +1,12 @@ +package com.umc.refit.domain.dto.chat; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +@AllArgsConstructor +public class OtherImage { + private String otherImage; +} \ No newline at end of file diff --git a/src/main/java/com/umc/refit/web/config/OAuth2ResourceServer.java b/src/main/java/com/umc/refit/web/config/OAuth2ResourceServer.java index b206f46..723f0b3 100644 --- a/src/main/java/com/umc/refit/web/config/OAuth2ResourceServer.java +++ b/src/main/java/com/umc/refit/web/config/OAuth2ResourceServer.java @@ -48,6 +48,7 @@ SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception { , "/static/**" //카카오 주소 api , "/*.html" //카카오 주소 api , "/oauth2/fcm" + , "/oauth2/image" , "/auth/join/name" // , "/**" //임시로 모든 인증 처리 제외 ).permitAll() diff --git a/src/main/java/com/umc/refit/web/controller/OauthController.java b/src/main/java/com/umc/refit/web/controller/OauthController.java index 1bd3d8d..f1d2950 100644 --- a/src/main/java/com/umc/refit/web/controller/OauthController.java +++ b/src/main/java/com/umc/refit/web/controller/OauthController.java @@ -2,6 +2,7 @@ import com.umc.refit.domain.dto.chat.FCM; import com.umc.refit.domain.dto.chat.OAuth2; +import com.umc.refit.domain.dto.chat.OtherImage; import com.umc.refit.domain.entity.Member; import com.umc.refit.exception.ExceptionType; import com.umc.refit.exception.member.TokenException; @@ -10,6 +11,7 @@ import org.springframework.security.core.Authentication; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestHeader; +import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import javax.servlet.http.HttpServletRequest; @@ -44,9 +46,15 @@ public FCM getFcm(@RequestHeader("otherId") String otherId) throws UnsupportedEn String decodedValue = URLDecoder.decode(otherId, "UTF-8"); Optional other = memberService.findMemberByName(decodedValue); - System.out.println("====================================="); - System.out.println(otherId); - return new FCM(other.get().getFcm()); } + + @GetMapping("/oauth2/image") + public OtherImage getImage(@RequestParam("otherId") String otherId) throws UnsupportedEncodingException { + + String decodedValue = URLDecoder.decode(otherId, "UTF-8"); + Optional other = memberService.findMemberByName(decodedValue); + + return new OtherImage(other.get().getImageUrl()); + } } diff --git a/src/main/java/com/umc/refit/web/filter/authorization/JwtAuthorizationRsaFilter.java b/src/main/java/com/umc/refit/web/filter/authorization/JwtAuthorizationRsaFilter.java index eef8578..2186a6c 100644 --- a/src/main/java/com/umc/refit/web/filter/authorization/JwtAuthorizationRsaFilter.java +++ b/src/main/java/com/umc/refit/web/filter/authorization/JwtAuthorizationRsaFilter.java @@ -46,6 +46,7 @@ protected boolean shouldNotFilter(HttpServletRequest request) { || pathMatcher.match("/auth/login", path) //일반 로그인 || pathMatcher.match("/*.html", path) || pathMatcher.match("/oauth2/fcm", path) + || pathMatcher.match("/oauth2/image", path) || pathMatcher.match("/auth/join/name", path) // || pathMatcher.match("/**", path) //API 테스트를 위해 모든 로직에 대해 인가 제외 ); diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 3049bb0..f3745b6 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -17,7 +17,7 @@ spring: jpa: hibernate: - ddl-auto: create + ddl-auto: update properties: hibernate: