利用Session进行登录校验
@Slf4j
@RestController
@CrossOrigin
public class LoginController {
@GetMapping("/c1")
public Result cookie1(HttpSession session){
session.setAttribute("Login","bmlg");
return new Result().success();
}
@GetMapping("/c2")
public Result cookie2(HttpServletRequest request){
HttpSession session=request.getSession();
Object loginUser=session.getAttribute("Login");
System.out.println(loginUser);
return new Result().success();
}
}