[user-service] 이클립스 문제(Problems) 해결
This commit is contained in:
@@ -30,6 +30,7 @@ import java.util.Collections;
|
|||||||
* 수정일 수정자 수정내용
|
* 수정일 수정자 수정내용
|
||||||
* ---------- -------- ---------------------------
|
* ---------- -------- ---------------------------
|
||||||
* 2021/06/30 jaeyeolkim 최초 생성
|
* 2021/06/30 jaeyeolkim 최초 생성
|
||||||
|
* 2024/09/25 이백행 컨트리뷰션 이클립스 문제(Problems) 해결
|
||||||
* </pre>
|
* </pre>
|
||||||
*/
|
*/
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@@ -47,7 +48,8 @@ public class CustomOAuth2UserService implements OAuth2UserService<OAuth2UserRequ
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public OAuth2User loadUser(OAuth2UserRequest userRequest) throws OAuth2AuthenticationException {
|
public OAuth2User loadUser(OAuth2UserRequest userRequest) throws OAuth2AuthenticationException {
|
||||||
OAuth2UserService delegate = new DefaultOAuth2UserService();
|
// OAuth2UserService delegate = new DefaultOAuth2UserService();
|
||||||
|
OAuth2UserService<OAuth2UserRequest, OAuth2User> delegate = new DefaultOAuth2UserService();
|
||||||
OAuth2User oAuth2User = delegate.loadUser(userRequest);
|
OAuth2User oAuth2User = delegate.loadUser(userRequest);
|
||||||
|
|
||||||
// 현재 로그인 진행 중인 서비스를 구분하는 코드(구글 or 네이버..)
|
// 현재 로그인 진행 중인 서비스를 구분하는 코드(구글 or 네이버..)
|
||||||
|
|||||||
@@ -26,6 +26,10 @@ import java.io.Serializable;
|
|||||||
*/
|
*/
|
||||||
@Getter
|
@Getter
|
||||||
public class SessionUser implements Serializable {
|
public class SessionUser implements Serializable {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = -6319235143325686744L;
|
||||||
private String userName;
|
private String userName;
|
||||||
private String email;
|
private String email;
|
||||||
|
|
||||||
|
|||||||
@@ -70,6 +70,9 @@ public class AuthorizationService extends AbstractService {
|
|||||||
* @return Page<AuthorizationListResponseDto> 페이지 인가 목록 응답 DTO
|
* @return Page<AuthorizationListResponseDto> 페이지 인가 목록 응답 DTO
|
||||||
*/
|
*/
|
||||||
public Page<AuthorizationListResponseDto> findPage(RequestDto requestDto, Pageable pageable) {
|
public Page<AuthorizationListResponseDto> findPage(RequestDto requestDto, Pageable pageable) {
|
||||||
|
if (log.isDebugEnabled()) {
|
||||||
|
log.debug("requestDto={}", requestDto);
|
||||||
|
}
|
||||||
return authorizationRepository.findPage(requestDto, pageable);
|
return authorizationRepository.findPage(requestDto, pageable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -807,51 +807,51 @@ public class UserService extends AbstractService implements UserDetailsService {
|
|||||||
return user.orElse(null);
|
return user.orElse(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
* 소셜 사용자 엔티티 조회
|
// * 소셜 사용자 엔티티 조회
|
||||||
* 등록되어 있지 않은 경우 사용자 등록
|
// * 등록되어 있지 않은 경우 사용자 등록
|
||||||
*
|
// *
|
||||||
* @param providerCode 공급자 코드
|
// * @param providerCode 공급자 코드
|
||||||
* @param providerId 공급자 id
|
// * @param providerId 공급자 id
|
||||||
* @param email 이메일
|
// * @param email 이메일
|
||||||
* @param userName 사용자 명
|
// * @param userName 사용자 명
|
||||||
* @return UserLoginRequestDto 사용자 로그인 요청 DTO
|
// * @return UserLoginRequestDto 사용자 로그인 요청 DTO
|
||||||
*/
|
// */
|
||||||
private UserResponseDto getAndSaveSocialUser(String providerCode, String providerId, String email, String userName) {
|
// private UserResponseDto getAndSaveSocialUser(String providerCode, String providerId, String email, String userName) {
|
||||||
User user = findSocialUser(providerCode, providerId);
|
// User user = findSocialUser(providerCode, providerId);
|
||||||
|
//
|
||||||
// 이메일로 조회
|
// // 이메일로 조회
|
||||||
// 공급자에서 동일한 이메일을 사용할 수 있고
|
// // 공급자에서 동일한 이메일을 사용할 수 있고
|
||||||
// 현재 시스템 구조 상 이메일을 사용자 식별키로 사용하고 있어서 이메일로 사용자를 한번 더 검색한다.
|
// // 현재 시스템 구조 상 이메일을 사용자 식별키로 사용하고 있어서 이메일로 사용자를 한번 더 검색한다.
|
||||||
if (user == null) {
|
// if (user == null) {
|
||||||
user = userRepository.findByEmail(email).orElse(null);
|
// user = userRepository.findByEmail(email).orElse(null);
|
||||||
|
//
|
||||||
// 공급자 id로 조회되지 않지만 이메일로 조회되는 경우 공급자 id 등록
|
// // 공급자 id로 조회되지 않지만 이메일로 조회되는 경우 공급자 id 등록
|
||||||
if (user != null) {
|
// if (user != null) {
|
||||||
user.setSocial(providerCode, providerId);
|
// user.setSocial(providerCode, providerId);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if (user == null) {
|
// if (user == null) {
|
||||||
// 사용자 등록
|
// // 사용자 등록
|
||||||
final String userId = UUID.randomUUID().toString();
|
// final String userId = UUID.randomUUID().toString();
|
||||||
//final String password = makeRandomPassword(); // 임의 비밀번호 생성 시 복호화 불가능
|
// //final String password = makeRandomPassword(); // 임의 비밀번호 생성 시 복호화 불가능
|
||||||
|
//
|
||||||
user = User.builder()
|
// user = User.builder()
|
||||||
.email(email) // 100byte
|
// .email(email) // 100byte
|
||||||
//.encryptedPassword(passwordEncoder.encode(password)) // 100 byte
|
// //.encryptedPassword(passwordEncoder.encode(password)) // 100 byte
|
||||||
.userName(userName)
|
// .userName(userName)
|
||||||
.userId(userId)
|
// .userId(userId)
|
||||||
.role(Role.USER)
|
// .role(Role.USER)
|
||||||
.userStateCode(UserStateCode.NORMAL.getKey())
|
// .userStateCode(UserStateCode.NORMAL.getKey())
|
||||||
.build();
|
// .build();
|
||||||
user.setSocial(providerCode, providerId);
|
// user.setSocial(providerCode, providerId);
|
||||||
|
//
|
||||||
user = userRepository.save(user);
|
// user = userRepository.save(user);
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
return new UserResponseDto(user);
|
// return new UserResponseDto(user);
|
||||||
}
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
package org.egovframe.cloud.userservice.api.role;
|
package org.egovframe.cloud.userservice.api.role;
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import org.egovframe.cloud.userservice.api.role.dto.AuthorizationUpdateRequestDto;
|
import org.egovframe.cloud.userservice.api.role.dto.AuthorizationUpdateRequestDto;
|
||||||
import org.egovframe.cloud.userservice.domain.role.Authorization;
|
import org.egovframe.cloud.userservice.domain.role.Authorization;
|
||||||
|
|||||||
@@ -5,14 +5,11 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
import org.springframework.boot.test.web.client.TestRestTemplate;
|
import org.springframework.boot.test.web.client.TestRestTemplate;
|
||||||
import org.springframework.context.MessageSource;
|
|
||||||
|
|
||||||
import java.util.Locale;
|
|
||||||
import org.springframework.test.context.ActiveProfiles;
|
import org.springframework.test.context.ActiveProfiles;
|
||||||
import org.springframework.test.context.TestPropertySource;
|
import org.springframework.test.context.TestPropertySource;
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT;
|
|
||||||
|
|
||||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
||||||
@EnableConfigurationProperties
|
@EnableConfigurationProperties
|
||||||
|
|||||||
@@ -30,6 +30,11 @@ import java.util.List;
|
|||||||
public class RestResponsePage<T> extends PageImpl<T> {
|
public class RestResponsePage<T> extends PageImpl<T> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = -5737360124251098346L;
|
||||||
|
|
||||||
|
/**
|
||||||
* Rest 응답 페이지 생성자
|
* Rest 응답 페이지 생성자
|
||||||
*
|
*
|
||||||
* @param content 목록
|
* @param content 목록
|
||||||
|
|||||||
Reference in New Issue
Block a user