From ec096a2cccc9917e7b404f54c5928095994c8187 Mon Sep 17 00:00:00 2001 From: paragon0107 Date: Wed, 10 Jul 2024 23:55:35 +0900 Subject: [PATCH] =?UTF-8?q?[HOTFIX]=20filterChain.doFilter=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/tiki/server/auth/config/SecurityConfig.java | 3 ++- .../com/tiki/server/auth/filter/ExceptionHandlerFilter.java | 2 +- .../com/tiki/server/auth/filter/JwtAuthenticationFilter.java | 5 ++++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/tiki/server/auth/config/SecurityConfig.java b/src/main/java/com/tiki/server/auth/config/SecurityConfig.java index 037dede6..43173b47 100644 --- a/src/main/java/com/tiki/server/auth/config/SecurityConfig.java +++ b/src/main/java/com/tiki/server/auth/config/SecurityConfig.java @@ -25,6 +25,7 @@ public class SecurityConfig { private final CustomAuthenticationEntryPointHandler customAuthenticationEntryPointHandler; private final CustomAccessDeniedHandler customAccessDeniedHandler; private final JwtAuthenticationFilter jwtAuthenticationFilter; + private final ExceptionHandlerFilter exceptionHandlerFilter; @Bean public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { @@ -51,7 +52,7 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { jwtAuthenticationFilter, UsernamePasswordAuthenticationFilter.class ) .addFilterBefore( - new ExceptionHandlerFilter(), JwtAuthenticationFilter.class + exceptionHandlerFilter, JwtAuthenticationFilter.class ) .build(); } diff --git a/src/main/java/com/tiki/server/auth/filter/ExceptionHandlerFilter.java b/src/main/java/com/tiki/server/auth/filter/ExceptionHandlerFilter.java index 6dc77ed5..a7f14506 100644 --- a/src/main/java/com/tiki/server/auth/filter/ExceptionHandlerFilter.java +++ b/src/main/java/com/tiki/server/auth/filter/ExceptionHandlerFilter.java @@ -23,6 +23,6 @@ protected void doFilterInternal( @NonNull HttpServletResponse response, @NonNull FilterChain filterChain ) throws ServletException, IOException { - + filterChain.doFilter(request, response); } } diff --git a/src/main/java/com/tiki/server/auth/filter/JwtAuthenticationFilter.java b/src/main/java/com/tiki/server/auth/filter/JwtAuthenticationFilter.java index ad1ef5b6..42140859 100644 --- a/src/main/java/com/tiki/server/auth/filter/JwtAuthenticationFilter.java +++ b/src/main/java/com/tiki/server/auth/filter/JwtAuthenticationFilter.java @@ -7,6 +7,7 @@ import com.tiki.server.auth.jwt.UserAuthentication; import com.tiki.server.common.Constants; import jakarta.servlet.FilterChain; +import jakarta.servlet.ServletException; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; import lombok.NonNull; @@ -38,7 +39,7 @@ protected void doFilterInternal( @NonNull HttpServletRequest request, @NonNull HttpServletResponse response, @NonNull FilterChain filterChain - ) throws IOException { + ) throws IOException, ServletException { try { val token = jwtProvider.getAccessTokenFromRequest(request); if (hasText(token) && jwtValidator.validateToken(token) == VALID_JWT) { @@ -49,5 +50,7 @@ protected void doFilterInternal( } catch (Exception e) { log.error(e.getMessage()); } + + filterChain.doFilter(request, response); } }