diff --git a/src/main/java/com/soongsil/CoffeeChat/config/jwt/JWTFilter.java b/src/main/java/com/soongsil/CoffeeChat/config/jwt/JWTFilter.java index d44b981..288bffa 100644 --- a/src/main/java/com/soongsil/CoffeeChat/config/jwt/JWTFilter.java +++ b/src/main/java/com/soongsil/CoffeeChat/config/jwt/JWTFilter.java @@ -2,6 +2,7 @@ import java.io.IOException; +import com.soongsil.CoffeeChat.dto.Oauth.UserDTO; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; @@ -10,7 +11,6 @@ import org.springframework.web.filter.OncePerRequestFilter; import com.soongsil.CoffeeChat.dto.Oauth.CustomOAuth2User; -import com.soongsil.CoffeeChat.dto.UserDTO; import jakarta.servlet.FilterChain; import jakarta.servlet.ServletException; diff --git a/src/main/java/com/soongsil/CoffeeChat/dto/Oauth/CustomOAuth2User.java b/src/main/java/com/soongsil/CoffeeChat/dto/Oauth/CustomOAuth2User.java index 9e7c6c9..ff04c29 100644 --- a/src/main/java/com/soongsil/CoffeeChat/dto/Oauth/CustomOAuth2User.java +++ b/src/main/java/com/soongsil/CoffeeChat/dto/Oauth/CustomOAuth2User.java @@ -7,7 +7,6 @@ import org.springframework.security.core.GrantedAuthority; import org.springframework.security.oauth2.core.user.OAuth2User; -import com.soongsil.CoffeeChat.dto.UserDTO; public class CustomOAuth2User implements OAuth2User { private final UserDTO userDTO; diff --git a/src/main/java/com/soongsil/CoffeeChat/dto/Oauth/UserDTO.java b/src/main/java/com/soongsil/CoffeeChat/dto/Oauth/UserDTO.java index 9e594e4..9ac6a4c 100644 --- a/src/main/java/com/soongsil/CoffeeChat/dto/Oauth/UserDTO.java +++ b/src/main/java/com/soongsil/CoffeeChat/dto/Oauth/UserDTO.java @@ -1,4 +1,4 @@ -package com.soongsil.CoffeeChat.dto; +package com.soongsil.CoffeeChat.dto.Oauth; import lombok.Getter; import lombok.Setter; diff --git a/src/main/java/com/soongsil/CoffeeChat/service/CustomOAuth2UserService.java b/src/main/java/com/soongsil/CoffeeChat/service/CustomOAuth2UserService.java index f76fd1a..ff71120 100644 --- a/src/main/java/com/soongsil/CoffeeChat/service/CustomOAuth2UserService.java +++ b/src/main/java/com/soongsil/CoffeeChat/service/CustomOAuth2UserService.java @@ -1,18 +1,13 @@ package com.soongsil.CoffeeChat.service; import com.soongsil.CoffeeChat.controller.exception.CustomException; +import com.soongsil.CoffeeChat.dto.Oauth.*; import org.springframework.security.oauth2.client.userinfo.DefaultOAuth2UserService; import org.springframework.security.oauth2.client.userinfo.OAuth2UserRequest; import org.springframework.security.oauth2.core.OAuth2AuthenticationException; import org.springframework.security.oauth2.core.user.OAuth2User; import org.springframework.stereotype.Service; -import com.soongsil.CoffeeChat.dto.Oauth.CustomOAuth2User; -import com.soongsil.CoffeeChat.dto.Oauth.GoogleResponse; -import com.soongsil.CoffeeChat.dto.Oauth.KakaoResponse; -import com.soongsil.CoffeeChat.dto.Oauth.NaverResponse; -import com.soongsil.CoffeeChat.dto.Oauth.OAuth2Response; -import com.soongsil.CoffeeChat.dto.UserDTO; import com.soongsil.CoffeeChat.entity.User; import com.soongsil.CoffeeChat.repository.User.UserRepository; @@ -30,10 +25,7 @@ public CustomOAuth2UserService(UserRepository userRepository) { private User findUserByUsername(String username){ return userRepository.findByUsername(username) - .orElseThrow(() -> new CustomException( - USER_NOT_FOUND.getHttpStatusCode(), - USER_NOT_FOUND.getErrorMessage()) - ); + .orElse(null); } //리소스 서버에서 제공되는 유저정보 가져오기 diff --git a/src/main/java/com/soongsil/CoffeeChat/util/email/EmailUtil.java b/src/main/java/com/soongsil/CoffeeChat/util/email/EmailUtil.java index 671fc2d..bbe38ac 100644 --- a/src/main/java/com/soongsil/CoffeeChat/util/email/EmailUtil.java +++ b/src/main/java/com/soongsil/CoffeeChat/util/email/EmailUtil.java @@ -47,6 +47,7 @@ public String sendAuthenticationEmail(String receiver) throws InterruptedExcepti } catch (Exception e) { // 예외가 발생했을 때 로그를 남기고, 기본 코드 반환 등을 처리 System.out.println("SQS 메시지 전송 실패: " + e.getMessage()); + throw new RuntimeException("메일전송실패"); } return code; diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 28bfaca..3eb7516 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -13,7 +13,7 @@ spring: password: ${DB_PW} jpa: hibernate: - ddl-auto: none + ddl-auto: update naming: physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl database: mysql