feat(security): 添加 JWT 认证功能
- 在后端添加 JWT 认证过滤器 JwtAuthenticationTokenFilter - 创建 JwtTokenUtil 工具类用于生成和验证 JWT token - 在 application.yml 中配置 JWT 相关参数 - 更新前端 HomePage 组件,增加用户认证相关逻辑
This commit is contained in:
@@ -29,3 +29,10 @@ mybatis-plus:
|
||||
mapper-locations: classpath:mapper/*.xml
|
||||
configuration:
|
||||
map-underscore-to-camel-case: true
|
||||
|
||||
# JWT 配置
|
||||
jwt:
|
||||
secret: mysecretkeymysecretkeymysecretkeymysecretkeymysecretkey # 至少256位的密钥
|
||||
expiration: 86400 # token有效期,单位秒,这里是24小时
|
||||
header: Authorization # JWT存储的请求头
|
||||
tokenHead: "Bearer " # JWT负载中拿到开头
|
||||
|
||||
Reference in New Issue
Block a user