50 lines
1.5 KiB
Java
50 lines
1.5 KiB
Java
package com.cnbm.admin.controller;
|
|
|
|
import com.cnbm.admin.handler.LogoutSuccessHandlerImpl;
|
|
import com.cnbm.admin.params.LoginParam;
|
|
import com.cnbm.admin.service.LoginService;
|
|
import com.cnbm.admin.utils.ResponseResult;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import lombok.extern.log4j.Log4j2;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
|
|
import org.springframework.security.core.Authentication;
|
|
import org.springframework.security.core.context.SecurityContextHolder;
|
|
import org.springframework.security.web.authentication.logout.SecurityContextLogoutHandler;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
/**
|
|
* @Author weihongyang
|
|
* @Date 2022/6/7 3:55 PM
|
|
* @Version 1.0
|
|
*/
|
|
@RestController
|
|
@Api(tags="登录管理")
|
|
@Log4j2
|
|
public class LoginController {
|
|
|
|
@Autowired
|
|
private LoginService loginService;
|
|
|
|
@Autowired
|
|
private LogoutSuccessHandlerImpl logoutSuccessHandler;
|
|
|
|
@PostMapping("/login")
|
|
@ApiOperation(value = "登录")
|
|
public ResponseResult login(HttpServletRequest request, @RequestBody LoginParam loginParam) {
|
|
return loginService.login(request,loginParam);
|
|
}
|
|
|
|
@PostMapping("/doLogout")
|
|
@ApiOperation(value = "退出")
|
|
public void logout(){
|
|
}
|
|
|
|
|
|
}
|