chore: auth 패키지 구조 리팩터링

- web 관련(controller, 어노테이션, interceptor, argument_resolver)
- business 관련(service..)
- infrastructure 관련(jwt..)
This commit is contained in:
이상진 2025-07-13 16:18:10 +09:00
parent 99315b5de8
commit 1202f4da2f
23 changed files with 45 additions and 50 deletions

View File

@ -6,7 +6,7 @@ import io.swagger.v3.oas.annotations.responses.ApiResponses
import io.swagger.v3.oas.annotations.tags.Tag
import org.springframework.http.HttpStatus
import org.springframework.web.bind.annotation.ResponseStatus
import roomescape.system.auth.annotation.Admin
import roomescape.system.auth.web.support.Admin
import roomescape.system.dto.response.RoomEscapeApiResponse
@Tag(name = "2. 회원 API", description = "회원 정보를 관리할 때 사용합니다.")

View File

@ -37,9 +37,9 @@ import roomescape.reservation.dto.response.ReservationResponse;
import roomescape.reservation.dto.response.ReservationsResponse;
import roomescape.reservation.service.ReservationService;
import roomescape.reservation.service.ReservationWithPaymentService;
import roomescape.system.auth.annotation.Admin;
import roomescape.system.auth.annotation.LoginRequired;
import roomescape.system.auth.annotation.MemberId;
import roomescape.system.auth.web.support.Admin;
import roomescape.system.auth.web.support.LoginRequired;
import roomescape.system.auth.web.support.MemberId;
import roomescape.system.dto.response.ErrorResponse;
import roomescape.system.dto.response.RoomEscapeApiResponse;
import roomescape.system.exception.RoomEscapeException;

View File

@ -28,8 +28,8 @@ import roomescape.reservation.dto.response.ReservationTimeInfosResponse;
import roomescape.reservation.dto.response.ReservationTimeResponse;
import roomescape.reservation.dto.response.ReservationTimesResponse;
import roomescape.reservation.service.ReservationTimeService;
import roomescape.system.auth.annotation.Admin;
import roomescape.system.auth.annotation.LoginRequired;
import roomescape.system.auth.web.support.Admin;
import roomescape.system.auth.web.support.LoginRequired;
import roomescape.system.dto.response.ErrorResponse;
import roomescape.system.dto.response.RoomEscapeApiResponse;

View File

@ -1,4 +1,4 @@
package roomescape.system.auth.jwt;
package roomescape.system.auth.infrastructure.jwt;
import java.util.Date;
@ -12,7 +12,6 @@ import io.jsonwebtoken.MalformedJwtException;
import io.jsonwebtoken.SignatureAlgorithm;
import io.jsonwebtoken.SignatureException;
import io.jsonwebtoken.UnsupportedJwtException;
import roomescape.system.auth.jwt.dto.TokenDto;
import roomescape.system.exception.ErrorType;
import roomescape.system.exception.RoomEscapeException;

View File

@ -0,0 +1,4 @@
package roomescape.system.auth.infrastructure.jwt;
public record TokenDto(String accessToken) {
}

View File

@ -1,4 +0,0 @@
package roomescape.system.auth.jwt.dto;
public record TokenDto(String accessToken) {
}

View File

@ -4,10 +4,10 @@ import org.springframework.stereotype.Service;
import roomescape.member.business.MemberService;
import roomescape.member.infrastructure.persistence.Member;
import roomescape.system.auth.dto.LoginCheckResponse;
import roomescape.system.auth.dto.LoginRequest;
import roomescape.system.auth.jwt.JwtHandler;
import roomescape.system.auth.jwt.dto.TokenDto;
import roomescape.system.auth.web.LoginCheckResponse;
import roomescape.system.auth.web.LoginRequest;
import roomescape.system.auth.infrastructure.jwt.JwtHandler;
import roomescape.system.auth.infrastructure.jwt.TokenDto;
@Service
public class AuthService {

View File

@ -1,4 +1,4 @@
package roomescape.system.auth.controller;
package roomescape.system.auth.web;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.GetMapping;
@ -18,11 +18,9 @@ import jakarta.servlet.http.Cookie;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.Valid;
import roomescape.system.auth.annotation.LoginRequired;
import roomescape.system.auth.annotation.MemberId;
import roomescape.system.auth.dto.LoginCheckResponse;
import roomescape.system.auth.dto.LoginRequest;
import roomescape.system.auth.jwt.dto.TokenDto;
import roomescape.system.auth.web.support.LoginRequired;
import roomescape.system.auth.web.support.MemberId;
import roomescape.system.auth.infrastructure.jwt.TokenDto;
import roomescape.system.auth.service.AuthService;
import roomescape.system.dto.response.ErrorResponse;
import roomescape.system.dto.response.RoomEscapeApiResponse;

View File

@ -1,4 +1,4 @@
package roomescape.system.auth.dto;
package roomescape.system.auth.web;
import io.swagger.v3.oas.annotations.media.Schema;

View File

@ -1,4 +1,4 @@
package roomescape.system.auth.dto;
package roomescape.system.auth.web;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Email;

View File

@ -1,4 +1,4 @@
package roomescape.system.auth.annotation;
package roomescape.system.auth.web.support;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;

View File

@ -1,4 +1,4 @@
package roomescape.system.auth.interceptor;
package roomescape.system.auth.web.support;
import java.util.Arrays;
@ -12,8 +12,7 @@ import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import roomescape.member.business.MemberService;
import roomescape.member.infrastructure.persistence.Member;
import roomescape.system.auth.annotation.Admin;
import roomescape.system.auth.jwt.JwtHandler;
import roomescape.system.auth.infrastructure.jwt.JwtHandler;
import roomescape.system.exception.ErrorType;
import roomescape.system.exception.RoomEscapeException;

View File

@ -1,4 +1,4 @@
package roomescape.system.auth.interceptor;
package roomescape.system.auth.web.support;
import java.util.Arrays;
@ -12,8 +12,7 @@ import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import roomescape.member.business.MemberService;
import roomescape.member.infrastructure.persistence.Member;
import roomescape.system.auth.annotation.LoginRequired;
import roomescape.system.auth.jwt.JwtHandler;
import roomescape.system.auth.infrastructure.jwt.JwtHandler;
import roomescape.system.exception.ErrorType;
import roomescape.system.exception.RoomEscapeException;

View File

@ -1,4 +1,4 @@
package roomescape.system.auth.annotation;
package roomescape.system.auth.web.support;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;

View File

@ -1,4 +1,4 @@
package roomescape.system.auth.annotation;
package roomescape.system.auth.web.support;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;

View File

@ -1,4 +1,4 @@
package roomescape.system.auth.resolver;
package roomescape.system.auth.web.support;
import java.util.Arrays;
@ -12,8 +12,7 @@ import org.springframework.web.method.support.ModelAndViewContainer;
import jakarta.servlet.http.Cookie;
import jakarta.servlet.http.HttpServletRequest;
import roomescape.system.auth.annotation.MemberId;
import roomescape.system.auth.jwt.JwtHandler;
import roomescape.system.auth.infrastructure.jwt.JwtHandler;
import roomescape.system.exception.ErrorType;
import roomescape.system.exception.RoomEscapeException;

View File

@ -7,9 +7,9 @@ import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import roomescape.system.auth.interceptor.AdminInterceptor;
import roomescape.system.auth.interceptor.LoginInterceptor;
import roomescape.system.auth.resolver.MemberIdResolver;
import roomescape.system.auth.web.support.AdminInterceptor;
import roomescape.system.auth.web.support.LoginInterceptor;
import roomescape.system.auth.web.support.MemberIdResolver;
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {

View File

@ -21,8 +21,8 @@ import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotNull;
import roomescape.system.auth.annotation.Admin;
import roomescape.system.auth.annotation.LoginRequired;
import roomescape.system.auth.web.support.Admin;
import roomescape.system.auth.web.support.LoginRequired;
import roomescape.system.dto.response.ErrorResponse;
import roomescape.system.dto.response.RoomEscapeApiResponse;
import roomescape.theme.dto.ThemeRequest;

View File

@ -4,8 +4,8 @@ import org.springframework.stereotype.Controller
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.PathVariable
import org.springframework.web.bind.annotation.RequestMapping
import roomescape.system.auth.annotation.Admin
import roomescape.system.auth.annotation.LoginRequired
import roomescape.system.auth.web.support.Admin
import roomescape.system.auth.web.support.LoginRequired
@Controller
class AuthPageController {

View File

@ -12,7 +12,7 @@ import org.springframework.boot.test.web.server.LocalServerPort
import org.springframework.data.repository.findByIdOrNull
import roomescape.member.infrastructure.persistence.Member
import roomescape.member.infrastructure.persistence.MemberRepository
import roomescape.system.auth.jwt.JwtHandler
import roomescape.system.auth.infrastructure.jwt.JwtHandler
const val NOT_LOGGED_IN_USERID: Long = 0;

View File

@ -17,7 +17,7 @@ import org.springframework.test.context.jdbc.Sql;
import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.SignatureAlgorithm;
import io.restassured.RestAssured;
import roomescape.system.auth.jwt.JwtHandler;
import roomescape.system.auth.infrastructure.jwt.JwtHandler;
import roomescape.system.exception.ErrorType;
import roomescape.system.exception.RoomEscapeException;

View File

@ -1,4 +1,4 @@
package roomescape.system.auth.service;
package roomescape.system.auth.business;
import static org.assertj.core.api.Assertions.*;
@ -13,9 +13,10 @@ import roomescape.member.business.MemberService;
import roomescape.member.infrastructure.persistence.Member;
import roomescape.member.infrastructure.persistence.MemberRepository;
import roomescape.member.infrastructure.persistence.Role;
import roomescape.system.auth.dto.LoginRequest;
import roomescape.system.auth.jwt.JwtHandler;
import roomescape.system.auth.jwt.dto.TokenDto;
import roomescape.system.auth.service.AuthService;
import roomescape.system.auth.web.LoginRequest;
import roomescape.system.auth.infrastructure.jwt.JwtHandler;
import roomescape.system.auth.infrastructure.jwt.TokenDto;
import roomescape.system.exception.RoomEscapeException;
@SpringBootTest

View File

@ -1,4 +1,4 @@
package roomescape.system.auth.controller;
package roomescape.system.auth.web;
import static org.assertj.core.api.Assertions.*;
import static org.hamcrest.Matchers.*;