Yes, it is possible i'm adding this response as the spring-security-jwt mentionned in the accepted request is now deprecated :
Depend on the authentication method, generally we use Username/Password :
First : we need to expand the UsernamePasswordAuthenticationFilter, which is subtype of AbstractAuthenticationProcessingFilter, see the docs
Here we must override AbstractAuthenticationProcessingFilter.successfulAuthentication() method, you need this library for jwt algorithm & processing and add the jwt in the header of response
Second : we need to override the OncePerRequestFilter and process the token and authenticate the user with help of doFilterInternal method