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); } }