支持不同域的前后端分离部署

This commit is contained in:
648540858
2023-03-15 19:05:56 +08:00
parent 95688e400b
commit 5fab97cf7e
23 changed files with 226 additions and 155 deletions

View File

@@ -27,7 +27,6 @@ import javax.servlet.http.HttpServletResponse;
import java.util.List;
@Tag(name = "用户管理")
@RestController
@RequestMapping("/api/user")
public class UserController {
@@ -47,7 +46,7 @@ public class UserController {
@Parameter(name = "username", description = "用户名", required = true)
@Parameter(name = "password", description = "密码32位md5加密", required = true)
public LoginUser login(HttpServletRequest request, HttpServletResponse response, @RequestParam String username, @RequestParam String password){
LoginUser user = null;
LoginUser user;
try {
user = SecurityUtils.login(username, password, authenticationManager);
} catch (AuthenticationException e) {
@@ -62,6 +61,25 @@ public class UserController {
return user;
}
// @GetMapping("/logout")
// @PostMapping("/logout")
// @Operation(summary = "登出")
// public LoginUser logout(){
// LoginUser user;
// try {
// user = SecurityUtils.login(username, password, authenticationManager);
// } catch (AuthenticationException e) {
// throw new ControllerException(ErrorCode.ERROR100.getCode(), e.getMessage());
// }
// if (user == null) {
// throw new ControllerException(ErrorCode.ERROR100.getCode(), "用户名或密码错误");
// }else {
// String jwt = JwtUtils.createToken(username, password);
// response.setHeader(JwtUtils.getHeader(), jwt);
// }
// return user;
// }
@PostMapping("/changePassword")
@Operation(summary = "修改密码")
@Parameter(name = "username", description = "用户名", required = true)