| | |
| | | import springfox.documentation.annotations.ApiIgnore; |
| | | |
| | | import javax.servlet.ServletException; |
| | | import javax.servlet.ServletRequest; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | |
| | | @Autowired |
| | | private LoginService service; |
| | | |
| | | @PostMapping("login") |
| | | @ApiOperation(value ="登录") |
| | | @Deprecated |
| | | //@PostMapping("login") |
| | | //@ApiOperation(value ="登录") |
| | | @ApiIgnore |
| | | public Response login(@RequestParam String userName, String password,HttpServletRequest request){ |
| | | return service.login(userName,password,request); |
| | | } |
| | | |
| | | @PostMapping("logout") |
| | | @ApiOperation(value ="退出登录") |
| | | public void logout(){ |
| | | service.logout(); |
| | | /**采取的是JWT方式登录,上面的普通登录弃用*/ |
| | | @PostMapping("login") |
| | | @ApiOperation(value ="登录") |
| | | public Response login4Jwt(@RequestParam String userName, String password,HttpServletRequest request){ |
| | | return service.login4Jwt(userName,password,request); |
| | | } |
| | | |
| | | /**拦截登录*//* |
| | | @GetMapping("/") |
| | | @ApiIgnore |
| | | public ModelAndView toLoginHtml(HttpServletRequest request, HttpServletResponse response,ModelAndView view) throws ServletException, IOException { |
| | | //request.getRequestDispatcher("login.html").forward(request,response); |
| | | System.out.println("转发啦..."); |
| | | //response.setContentType("text/html;charset=utf-8"); |
| | | //response.sendRedirect("http://localhost:8090/login.html"); |
| | | //response.sendRedirect("/login.html"); |
| | | view.setViewName("login"); |
| | | return view; |
| | | }*/ |
| | | @PostMapping("logout") |
| | | @ApiOperation(value ="退出登录") |
| | | public void logout(ServletRequest request){ |
| | | service.logout(request); |
| | | } |
| | | |
| | | /**拦截登录*/ |
| | | @GetMapping("unauthorized") |