Skip to content

Commit

Permalink
Merge pull request #139 from Soongsil-CoffeeChat/fix/#138
Browse files Browse the repository at this point in the history
fix: 유저 생성이 안되는 오류 해결(#138)
  • Loading branch information
KimKyoHwee authored Sep 3, 2024
2 parents 49d580a + 1ee7747 commit 9666a2d
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.soongsil.CoffeeChat.dto;
package com.soongsil.CoffeeChat.dto.Oauth;

import lombok.Getter;
import lombok.Setter;
Expand Down
Original file line number Diff line number Diff line change
@@ -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;

Expand All @@ -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);
}

//리소스 서버에서 제공되는 유저정보 가져오기
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9666a2d

Please sign in to comment.