Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@ public void createModificationRequest(Long userId, Long requestId, ModifyRequest
throw new BusinessException(ErrorCode.INVALID_REQUEST_STATUS);
}

User requestedBy = userRepository.findById(userId)
.orElseThrow(() -> new BusinessException(ErrorCode.USER_NOT_FOUND));
User requestedBy = originalRequest.getUser();

// 저장공간 크기 변경
if (dto.requestedVolumeSizeGiB() != null) {
Expand Down Expand Up @@ -134,8 +133,7 @@ public void createSingleChangeRequest(Long userId, Long requestId, SingleChangeR
throw new BusinessException(ErrorCode.INVALID_REQUEST_STATUS);
}

User requestedBy = userRepository.findById(userId)
.orElseThrow(() -> new BusinessException(ErrorCode.USER_NOT_FOUND));
User requestedBy = originalRequest.getUser();

// DTO 팩토리 메서드를 사용하여 검증된 ChangeRequest 생성 및 저장
ChangeRequest changeRequest = SingleChangeRequestDTO.createValidatedChangeRequest(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import org.springframework.http.HttpStatusCode;
import org.springframework.stereotype.Service;
import org.springframework.web.reactive.function.client.WebClient;
import org.springframework.web.reactive.function.client.WebClientResponseException;
import reactor.core.publisher.Mono;

import java.util.Map;
Expand Down Expand Up @@ -51,10 +50,8 @@ public void deleteUbuntuAccount(String username) {
.block();
log.info("사용자 삭제 성공: {}", username);
} catch (Exception e) {
if (!(e instanceof WebClientResponseException && ((WebClientResponseException)e).getStatusCode() == HttpStatus.NOT_FOUND)) {
log.error("사용자 삭제 API 호출 중 예기치 않은 오류: {}", username, e);
throw new BusinessException("사용자 삭제 API 호출 오류", ErrorCode.INTERNAL_SERVER_ERROR);
}
log.error("사용자 삭제 API 호출 중 예기치 않은 오류: {}", username, e);
throw new BusinessException("사용자 삭제 API 호출 오류", ErrorCode.INTERNAL_SERVER_ERROR);
}
Comment on lines 52 to 55
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,22 +64,12 @@ public UserAuthResponseDTO userAuth(UserAuthRequestDTO dto) {
String passwordBase64 = dto.passwordBase64();
log.debug("비밀번호를 확인합니다. username: {}", dto.username());

// 3. 사용자 및 비밀번호 일치 여부 확인
Request request = requestRepository.findByUbuntuUsernameAndUbuntuPasswordBase64(dto.username(), passwordBase64)
.orElseThrow(() -> {
// 3-1. 사용자 정보를 찾을 수 없을 때의 로그
log.warn("사용자 '{}'를 찾을 수 없거나 비밀번호가 일치하지 않습니다.", dto.username());
return new UnauthorizedException(ErrorCode.USER_NOT_FOUND);
});

// 4. 추가 비밀번호 일치 확인 (Optional: Optional로 처리되었기 때문에 이중 확인)
if (!passwordBase64.equals(request.getUbuntuPasswordBase64())) {
// 4-1. 비밀번호 불일치 로그
log.error("사용자 '{}'에 대해 데이터베이스 비밀번호와 암호화된 비밀번호가 일치하지 않습니다. (내부 로직 오류 가능성)", dto.username());
throw new UnauthorizedException(ErrorCode.INVALID_LOGIN_INFO);
}

// 5. 인증 성공 로그
log.info("사용자 '{}'의 인증이 성공적으로 완료되었습니다.", dto.username());

return new UserAuthResponseDTO(true, request.getUbuntuUsername());
Expand Down