Witam,
Wysyłam login i hasło postem, ale login i hasło lecą jaka parametry, a tego chciałbym uniknąć. Chciałbym przesłać przez @RequestBody. Gdy jest przez parametry to działa, a jak zrobić przez @ReqeuestBody
@RequestBody('/login')
public void test(@RequestBody User u){
//i co to tuwaj wywolac?
}
@Component
public class RestAuthenticationSuccessHandler
extends SimpleUrlAuthenticationSuccessHandler {authenticate
@Autowired
private UserRepo userService;
@Override
public void onAuthenticationSuccess(HttpServletRequest request,
HttpServletResponse response, Authentication authentication)
throws ServletException, IOException {
User user = userService.findByLogin(authentication.getName());
SecurityUtils.sendResponse(response, HttpServletResponse.SC_OK, user);
}
//
.loginProcessingUrl("/login")
.successHandler(restAuthenticationSuccessHandler)
.failureHandler(restAuthenticationFailureHandler)
.usernameParameter("username")
.passwordParameter("password")
}
Czy jest na to jakiś prosty sposób czy zostaje ręczne ustawienia autentykacji?