refactor: 重构安全架构,提取通用安全模块到common-security
- 将JwtAuthenticationFilter、JwtUtil、JwtProperties从auth服务移至common-security模块 - 新增common-security通用安全模块,提供JWT认证、权限验证等核心安全功能 - 重命名SecurityConfiguration为AuthSecurityConfiguration,使用common-security的filter - 新增JacksonConfiguration配置类,统一JSON序列化配置 - 新增头像更新功能AvatarUpdateRequestDTO - 移除冗余的UserLoginResponseDTO类 - 更新各服务模块的依赖配置以引入common-security模块 - 新增README.md项目说明文档 Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
package cn.meowrain.aioj.backend.framework.core.jackson;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.module.SimpleModule;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
|
||||
/**
|
||||
* Jackson 全局配置
|
||||
* 解决 Long 类型在前端 JavaScript 精度丢失问题
|
||||
*/
|
||||
@AutoConfiguration
|
||||
@ConditionalOnClass(ObjectMapper.class)
|
||||
public class JacksonConfiguration {
|
||||
|
||||
/**
|
||||
* 自定义 Jackson ObjectMapper 配置
|
||||
* 将 Long 和 long 类型序列化为 String
|
||||
*/
|
||||
@Bean
|
||||
public Jackson2ObjectMapperBuilderCustomizer jackson2ObjectMapperBuilderCustomizer() {
|
||||
return builder -> {
|
||||
// 注册 JavaTimeModule 处理时间类型
|
||||
builder.modules(new JavaTimeModule());
|
||||
|
||||
// Long 和 long 类型序列化为 String,避免前端精度丢失
|
||||
builder.serializerByType(Long.class, ToStringSerializer.instance);
|
||||
builder.serializerByType(Long.TYPE, ToStringSerializer.instance);
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,2 +1,3 @@
|
||||
cn.meowrain.aioj.backend.framework.core.banner.config.AIOJBannerAutoConfiguration
|
||||
cn.meowrain.aioj.backend.framework.core.config.WebAutoConfiguration
|
||||
cn.meowrain.aioj.backend.framework.core.config.WebAutoConfiguration
|
||||
cn.meowrain.aioj.backend.framework.core.jackson.JacksonConfiguration
|
||||
Reference in New Issue
Block a user