feat(auth): 新增用户ID上下文过滤器及登出逻辑优化

- 新增 GlobalConstants 常量类定义 USER_ID 常量
- 新增 HeaderUserId2ContextFilter 过滤器从请求头获取用户 ID 并存入 ThreadLocal
- 新增 LoginUserContextHolder 工具类用于管理用户 ID 的 ThreadLocal 操作
-优化 UserController 的 logout 方法,移除手动传参 userId,改为从上下文获取
- 优化 UserServiceImpl 的 logout 方法实现,通过上下文获取用户 ID 完成登出
- 在 han-note-gateway 模块中添加 tomcat-embed-core依赖以支持相关功能
This commit is contained in:
Hanserwei
2025-10-02 22:27:49 +08:00
parent 3cc615d38a
commit d448c524b7
7 changed files with 112 additions and 6 deletions

View File

@@ -64,6 +64,10 @@
<groupId>com.hanserwei</groupId>
<artifactId>hanserwei-spring-boot-starter-jackson</artifactId>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-core</artifactId>
</dependency>
</dependencies>