In order to create the authentication token at the SecurityServiceImpl class, it's needed to pass to the constructor the password in plain text.
I recommend saving the password in registration mapping and then pass it to autologin.
Example:
@PostMapping("/registration")
publicStringregistration(@ModelAttribute("userForm") UseruserForm, BindingResultbindingResult) {
Stringpw = userForm.getPassword();
userValidator.validate(userForm, bindingResult);
if (bindingResult.hasErrors()) {
return"registration";
}
userService.save(userForm);
securityService.autoLogin(userForm.getUsername(), pw);
return"redirect:/welcome";
}
In order to create the authentication token at the SecurityServiceImpl class, it's needed to pass to the constructor the password in plain text.
I recommend saving the password in registration mapping and then pass it to autologin.
Example: