Skip to content

Commit f9659c3

Browse files
authored
Merge pull request #402 from JECT-Study/feat/343-feat-jwtexceptionhandlerfilter
feat: JWT 인증 필터에서 검증 토큰 처리 로직 개선
2 parents 1fa4e98 + a436a08 commit f9659c3

1 file changed

Lines changed: 3 additions & 9 deletions

File tree

src/main/java/org/ject/support/common/security/jwt/JwtAuthenticationFilter.java

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -63,19 +63,13 @@ protected void doFilterInternal(HttpServletRequest request, HttpServletResponse
6363

6464
if (verificationToken != null) {
6565
if (jwtTokenProvider.validateToken(verificationToken)) {
66-
// 토큰이 유효한 경우, 인증 정보를 SecurityContext에 설정
67-
Authentication auth = jwtTokenProvider.getAuthenticationByToken(accessToken);
66+
String email = jwtTokenProvider.extractEmailFromVerificationToken(verificationToken);
67+
Authentication auth = createVerificationAuthentication(email);
6868
SecurityContextHolder.getContext().setAuthentication(auth);
6969
} else {
70-
clearAuthCookie(response, "Authentication auth = jwtTokenProvider.getAuthenticationByToken(accessToken);\n" +
71-
" SecurityContextHolder.getContext().setAuthentication(auth);");
70+
clearAuthCookie(response, "verificationToken");
7271
SecurityContextHolder.clearContext();
7372
}
74-
75-
String email = jwtTokenProvider.extractEmailFromVerificationToken(verificationToken);
76-
77-
Authentication auth = createVerificationAuthentication(email);
78-
SecurityContextHolder.getContext().setAuthentication(auth);
7973
}
8074

8175
chain.doFilter(request, response);

0 commit comments

Comments
 (0)