feat: uaa改造为Spring Authorization Server

This commit is contained in:
zlt2000
2023-12-12 10:48:32 +08:00
parent 671ab86543
commit 2a05c6ab91
81 changed files with 2917 additions and 520 deletions
@@ -1,18 +0,0 @@
package org.zlt.config;
import com.central.common.config.DefaultWebMvcConfig;
import org.springframework.context.annotation.Configuration;
/**
* web服务器配置
*
* @author zlt
* @version 1.0
* @date 2022/6/25
* <p>
* Blog: http://zlt2000.gitee.io
* Github: https://github.com/zlt2000
*/
@Configuration
public class WebMvcConfig extends DefaultWebMvcConfig {
}
@@ -1,8 +1,7 @@
package org.zlt.controller;
import com.central.common.annotation.LoginUser;
import com.central.common.context.LoginUserContextHolder;
import com.central.common.model.SysUser;
import com.central.common.utils.LoginUserUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@@ -18,18 +17,18 @@ import org.springframework.web.bind.annotation.RestController;
@RestController
public class TestController {
/**
* 通过 @LoginUser 获取当前登录人
* 通过 LoginUserUtils 获取当前登录人
*/
@GetMapping("/test/auth")
public String auth(@LoginUser SysUser user) {
return "auth:" + user.getUsername();
public String auth() {
return "auth:" + LoginUserUtils.getCurrentUser(false).getUsername();
}
/**
* 通过 LoginUserContextHolder 获取当前登录人
*/
@GetMapping("/test/auth2")
public String auth() {
public String auth2() {
return "auth2:" + LoginUserContextHolder.getUser().getUsername();
}