Skip to content

Commit

Permalink
Merge pull request #29 from Team-Tiki/hotfix/#28-security-200-issue
Browse files Browse the repository at this point in the history
[HOTFIX] filterChain.doFilter 추가
  • Loading branch information
paragon0107 authored Jul 10, 2024
2 parents 4840643 + ec096a2 commit 190e589
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -51,7 +52,7 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
jwtAuthenticationFilter, UsernamePasswordAuthenticationFilter.class
)
.addFilterBefore(
new ExceptionHandlerFilter(), JwtAuthenticationFilter.class
exceptionHandlerFilter, JwtAuthenticationFilter.class
)
.build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ protected void doFilterInternal(
@NonNull HttpServletResponse response,
@NonNull FilterChain filterChain
) throws ServletException, IOException {

filterChain.doFilter(request, response);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand All @@ -49,5 +50,7 @@ protected void doFilterInternal(
} catch (Exception e) {
log.error(e.getMessage());
}

filterChain.doFilter(request, response);
}
}

0 comments on commit 190e589

Please sign in to comment.