美文网首页
2020-07-08

2020-07-08

作者: 刘小刀tina | 来源:发表于2020-07-13 11:48 被阅读0次

    @RequestMapping(value = "/login",produces = "text/plain;charset=utf-8")
    public String login(AuthenticationRequest authenticationRequest, HttpSession session){
        UserDto userDto = authenticationService.authentication(authenticationRequest);
        //存入session
        session.setAttribute(UserDto.SESSION_USER_KEY,userDto);
        return userDto.getUsername() +"登录成功";
    }

    @GetMapping(value = "/logout",produces = {"text/plain;charset=UTF-8"})
    public String logout(HttpSession session){
        session.invalidate();
        return "退出成功";
    }


相关文章

网友评论

      本文标题:2020-07-08

      本文链接:https://www.haomeiwen.com/subject/cbfqcktx.html