I made it so that automatically register people after registration. It seems to do what you are looking for:
Authentication authentication = new UsernamePasswordAuthenticationToken( userService.loadUserByUsername(u.getUserName()), null, AuthorityUtils.createAuthorityList("ROLE_USER")); SecurityContextHolder.getContext().setAuthentication(authentication);
I grab my user from the service. This should implement the org.springframework.security.core.userdetails.UserDetails interface.
I think this should give you a good idea of ββwhat to do. I remember it took me a while to put this together from the documents.
source share