Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
추가한 코드
해결 과정
문제
swagger와 sign-up 접근이 안됨
원인
.permitAll() 설정은 Security 인증을 허용하지만, JwtAuthenticationFilter는 그대로 실행됨. JwtAuthenticationFilter에서 accessToken == null && refreshToken == null이면 요청이 컨트롤러까지 가지 않고 필터 체인에서 종료됨.
(Security에서 허용하더라도 JwtAuthenticationFilter가 먼저 실행되면 요청이 거부될 수 있음.)
기존 코드에서 됐던 이유
기존 코드에서는 accesstoken, refreshtoken 둘다 없을때 if (refreshToken == null) 를 통과하면서 checkAccessTokenAndAuthentication()가 실행되면서 JWT 없이도 filterChain.doFilter()가 호출되어 요청이 컨트롤러까지 도달했음.
해결 방법
NO_CHECK_URLS에 /swagger관련 주소와 /sign-up 추가하여 JwtAuthenticationFilter를 통과하지 않도록 설정
중요한점