diff --git a/src/main/kotlin/me/gistory/newbies_server_24/configurations/JwtFilter.kt b/src/main/kotlin/me/gistory/newbies_server_24/configurations/JwtFilter.kt index 3f1297c..1e3148d 100644 --- a/src/main/kotlin/me/gistory/newbies_server_24/configurations/JwtFilter.kt +++ b/src/main/kotlin/me/gistory/newbies_server_24/configurations/JwtFilter.kt @@ -13,9 +13,10 @@ class JwtFilter(private val tokenProvider: TokenProvider) : GenericFilterBean() val request = req as HttpServletRequest val token = resolveToken(request) token?.let { - tokenProvider.validateToken(it) - tokenProvider.getAuthentication(it).let { authentication -> - SecurityContextHolder.getContext().authentication = authentication + if (tokenProvider.validateToken(it)) { + tokenProvider.getAuthentication(it).let { authentication -> + SecurityContextHolder.getContext().authentication = authentication + } } } chain.doFilter(req, res)