Skip to content

Commit

Permalink
fix: do parse jwt iff token is valid
Browse files Browse the repository at this point in the history
  • Loading branch information
2paperstar committed Aug 30, 2024
1 parent 6b2a5c8 commit 370406e
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 370406e

Please sign in to comment.