diff --git a/backend/user-service/src/main/java/com/tadak/userservice/domain/member/service/MemberService.java b/backend/user-service/src/main/java/com/tadak/userservice/domain/member/service/MemberService.java index b4a8db3..a5f2aec 100644 --- a/backend/user-service/src/main/java/com/tadak/userservice/domain/member/service/MemberService.java +++ b/backend/user-service/src/main/java/com/tadak/userservice/domain/member/service/MemberService.java @@ -73,11 +73,6 @@ public SignupResponseDto signup(SignupRequestDto signupRequestDto) { } public ResponseEntity login(LoginRequestDto loginRequestDto) { - Member member = memberRepository.findByEmail(loginRequestDto.getEmail()) - .orElseThrow(() -> new NotFoundMemberException(ErrorCode.NOT_FOUND_MEMBER_ERROR)); - - validMemberState(member); // member State 검증 - Authentication authentication = getAuthentication(loginRequestDto); String accessToken = tokenProvider.createAccessToken(authentication); @@ -159,15 +154,6 @@ private void passwordConfirm(String password, String passwordConfirm) { } } - /** - * Member state 검증 - * @param member - */ - private static void validMemberState(Member member) { - if (member.getState() == State.DELETE){ - throw new MemberStateException(ErrorCode.NOT_VALID_MEMBER_STATE_ERROR); - } - } /** * loginMember 검증 diff --git a/backend/user-service/src/main/java/com/tadak/userservice/global/security/userdetail/CustomUserDetailsService.java b/backend/user-service/src/main/java/com/tadak/userservice/global/security/userdetail/CustomUserDetailsService.java index 3cdd623..5274d62 100644 --- a/backend/user-service/src/main/java/com/tadak/userservice/global/security/userdetail/CustomUserDetailsService.java +++ b/backend/user-service/src/main/java/com/tadak/userservice/global/security/userdetail/CustomUserDetailsService.java @@ -2,7 +2,9 @@ import com.tadak.userservice.domain.member.entity.Member; import com.tadak.userservice.domain.member.entity.State; +import com.tadak.userservice.domain.member.exception.MemberStateException; import com.tadak.userservice.domain.member.repository.MemberRepository; +import com.tadak.userservice.global.error.ErrorCode; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.security.core.GrantedAuthority; @@ -34,7 +36,7 @@ public UserDetails loadUserByUsername(String email) throws UsernameNotFoundExcep private UserDetails createMember(String username, Member member) { if (!member.getState().equals(State.ACTIVE)) { - throw new RuntimeException(username + " -> 활성화되어 있지 않습니다."); + throw new MemberStateException(ErrorCode.NOT_VALID_MEMBER_STATE_ERROR); } // List grantedAuthorities = member.getMemberAuthorities().stream()