How can I authenticate a user immediately after registration?

Hi. I started studying Spring Security and ran into a problem - when a user registers, he does not log in (that is, he has to go through authorization). I searched for information on various forums and websites - it says that you need to use UsernamePasswordAuthenticationToken, AuthenticationManager and SecurityContext. The problem is that the user becomes anonymous when going to any page, which makes it necessary to log in. Is it really necessary to use this particular option? Are there any examples of proper usage? Are there any other ways?
IMG_20250611_214332_124.jpg
IMG_20250611_214331_559.jpg
IMG_20250611_214331_521.jpg
Was this page helpful?