The goal of PreAuthenticatedAuthenticationToken is to integrate third-party identity management systems into your Spring application with Spring protection.
A PreAuthenticatedAuthenticationToken can be in the form of an HTTP header, an HTTP parameter, etc. In this case, it does not have to be a full user registration in your application. Just saving this token and the corresponding data will be enough.
For more information, see the Spring Security Documentation.
For the JWT case, although after decryption you can even use the UsernamePasswordAuthenticationToken , as the decryption process will show username, password, credentials.
source share