diff --git a/Second Seminar/SecondSeminar/src/main/java/com/example/SecondSeminar/common/auth/exception/AuthException.java b/Second Seminar/SecondSeminar/src/main/java/com/example/SecondSeminar/common/auth/exception/AuthException.java deleted file mode 100644 index 0518f69..0000000 --- a/Second Seminar/SecondSeminar/src/main/java/com/example/SecondSeminar/common/auth/exception/AuthException.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.example.SecondSeminar.common.auth.exception; - -import com.example.SecondSeminar.common.exception.BaseCustomException; -import com.example.SecondSeminar.common.exception.ExceptionType; - -public class AuthException extends BaseCustomException { - - public AuthException(ExceptionType exceptionType) { - super(exceptionType); - } - - @Override - public ExceptionType getExceptionType() { - return super.getExceptionType(); - } - - @Override - public String getMessage() { - return super.getMessage(); - } -} diff --git a/Second Seminar/SecondSeminar/src/main/java/com/example/SecondSeminar/common/auth/exception/AuthExceptionType.java b/Second Seminar/SecondSeminar/src/main/java/com/example/SecondSeminar/common/auth/exception/AuthExceptionType.java deleted file mode 100644 index 3c840e1..0000000 --- a/Second Seminar/SecondSeminar/src/main/java/com/example/SecondSeminar/common/auth/exception/AuthExceptionType.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.example.SecondSeminar.common.auth.exception; - -import com.example.SecondSeminar.common.exception.ExceptionType; -import lombok.RequiredArgsConstructor; -import org.springframework.http.HttpStatus; - -@RequiredArgsConstructor -public enum AuthExceptionType implements ExceptionType { - UNAUTHORIZED(HttpStatus.UNAUTHORIZED, "로그인이 필요합니다"); - - private final HttpStatus httpStatus; - private final String message; - - @Override - public HttpStatus httpStatus() { - return httpStatus; - } - - @Override - public String message() { - return message; - } - -} diff --git a/Second Seminar/SecondSeminar/src/main/java/com/example/SecondSeminar/member/application/AuthMemberService.java b/Second Seminar/SecondSeminar/src/main/java/com/example/SecondSeminar/member/application/AuthMemberService.java index 8ccbc40..802ef6b 100644 --- a/Second Seminar/SecondSeminar/src/main/java/com/example/SecondSeminar/member/application/AuthMemberService.java +++ b/Second Seminar/SecondSeminar/src/main/java/com/example/SecondSeminar/member/application/AuthMemberService.java @@ -2,11 +2,11 @@ import com.example.SecondSeminar.common.auth.JwtProvider; import com.example.SecondSeminar.common.auth.UserAuthentication; -import com.example.SecondSeminar.common.exception.BaseCustomException; import com.example.SecondSeminar.member.domain.AuthMember; import com.example.SecondSeminar.member.domain.AuthMemberJpaRepository; import com.example.SecondSeminar.member.dto.request.AuthMemberRequest; import com.example.SecondSeminar.member.dto.response.MemberSignInResponse; +import com.example.SecondSeminar.member.exception.MemberException; import com.example.SecondSeminar.member.exception.MemberExceptionType; import lombok.RequiredArgsConstructor; import org.springframework.security.core.Authentication; @@ -35,10 +35,10 @@ public String create(AuthMemberRequest request) { public MemberSignInResponse signIn(AuthMemberRequest request) { AuthMember authMember = authMemberJpaRepository.findByNickname(request.nickname()) - .orElseThrow(() -> new BaseCustomException(MemberExceptionType.NOT_FOUND_MEMBER)); + .orElseThrow(() -> new MemberException(MemberExceptionType.NOT_FOUND_MEMBER)); if (!passwordEncoder.matches(request.password(), authMember.getPassword())) { - throw new BaseCustomException(MemberExceptionType.INCORRECT_PASSWORD); + throw new MemberException(MemberExceptionType.INCORRECT_PASSWORD); } Authentication authentication = new UserAuthentication(authMember.getId(), null, null); diff --git a/Second Seminar/SecondSeminar/src/main/java/com/example/SecondSeminar/member/presentation/AuthMemberController.java b/Second Seminar/SecondSeminar/src/main/java/com/example/SecondSeminar/member/presentation/AuthMemberController.java index 7f116c4..acf6eb5 100644 --- a/Second Seminar/SecondSeminar/src/main/java/com/example/SecondSeminar/member/presentation/AuthMemberController.java +++ b/Second Seminar/SecondSeminar/src/main/java/com/example/SecondSeminar/member/presentation/AuthMemberController.java @@ -1,6 +1,5 @@ package com.example.SecondSeminar.member.presentation; -import com.example.SecondSeminar.common.auth.JwtProvider; import com.example.SecondSeminar.member.application.AuthMemberService; import com.example.SecondSeminar.member.dto.request.AuthMemberRequest; import com.example.SecondSeminar.member.dto.response.MemberSignInResponse; @@ -18,7 +17,6 @@ public class AuthMemberController { private final AuthMemberService authMemberService; - private final JwtProvider jwtProvider; @PostMapping("sign-up") public ResponseEntity signUp(@RequestBody AuthMemberRequest request) {