@@ -28,15 +28,6 @@ public class JwtAuthenticationFilter extends OncePerRequestFilter {
2828 @ Override
2929 protected void doFilterInternal (HttpServletRequest request , HttpServletResponse response , FilterChain filterChain ) throws ServletException , IOException {
3030
31- String path = request .getRequestURI ();
32- String method = request .getMethod ();
33-
34- // JWT 검증을 건너뛸 경로들
35- if (shouldSkipFilter (path , method )) {
36- filterChain .doFilter (request , response );
37- return ;
38- }
39-
4031 String header = request .getHeader ("Authorization" );
4132
4233 if (header != null && header .startsWith ("Bearer " )) {
@@ -57,79 +48,4 @@ protected void doFilterInternal(HttpServletRequest request, HttpServletResponse
5748
5849 filterChain .doFilter (request , response );
5950 }
60-
61- private boolean shouldSkipFilter (String path , String method ) {
62- // 정적 리소스
63- if (path .startsWith ("/static/" ) || path .startsWith ("/public/" ) ||
64- path .startsWith ("/resources/" ) || path .startsWith ("/META-INF/resources/" )) {
65- return true ;
66- }
67-
68- // 토스 페이먼트 관련
69- if (path .equals ("/billing.html" ) || path .startsWith ("/payments/" ) || path .startsWith ("/toss/" )) {
70- return true ;
71- }
72-
73- // 공개 API
74- if (path .equals ("/" ) || path .equals ("/favicon.ico" ) ||
75- path .startsWith ("/h2-console/" ) || path .equals ("/actuator/health" )) {
76- return true ;
77- }
78-
79- // 인증 API
80- if (path .startsWith ("/api/v1/auth/" )) {
81- return true ;
82- }
83-
84- // Swagger 및 API 문서
85- if (path .startsWith ("/swagger-ui/" ) || path .startsWith ("/v3/api-docs/" ) ||
86- path .equals ("/swagger-ui.html" ) || path .startsWith ("/webjars/" )) {
87- return true ;
88- }
89-
90- // WebSocket 및 알림
91- if (path .startsWith ("/notifications/" ) || path .startsWith ("/ws/" )) {
92- return true ;
93- }
94-
95- // 테스트 API
96- if (path .startsWith ("/api/test/" ) || path .equals ("/bid-test.html" ) ||
97- path .equals ("/websocket-test.html" )) {
98- return true ;
99- }
100-
101- // GET 요청 중 공개 API
102- if ("GET" .equals (method )) {
103- // 상품 조회 API
104- if (path .matches ("/api/[^/]+/products" ) ||
105- path .matches ("/api/[^/]+/products/\\ d+" ) ||
106- path .matches ("/api/[^/]+/products/es" ) ||
107- path .matches ("/api/[^/]+/products/members/\\ d+" ) ||
108- path .matches ("/api/[^/]+/products/es/members/\\ d+" )) {
109- return true ;
110- }
111-
112- // 회원 조회 API
113- if (path .matches ("/api/v1/members/\\ d+" )) {
114- return true ;
115- }
116- }
117-
118- // 업로드 파일
119- if (path .startsWith ("/uploads/" )) {
120- return true ;
121- }
122-
123- // 테스트 데이터 API
124- if (path .matches ("/api/[^/]+/test-data/.*" )) {
125- return true ;
126- }
127-
128- // 입찰 API (기존 로직 유지)
129- if (path .startsWith ("/api/v1/bids/" )) {
130- return true ;
131- }
132-
133- return false ;
134- }
13551}
0 commit comments