Good day! The challenge is to implement login / logout using Spring. Most of the examples found show implementation with redirection to the login form (jsp, html). I need to form a json response for the frontend developer. Tell me what are the fundamental differences between these two approaches? (mb stick a nose in examples or documentation that I did not catch the eye).
1 answer
So just return the POJO that describes your JSON response.
@Controller public class AuthController { @RequestMapping(patrh="/login", method=POST) @ResponseBody public AuthDto doLogin(...) { // ... return authDto; } @RequestMapping(patrh="/logout", method=POST) @ResponseBody public AuthDto doLogin() { // ... return authDto; } } |