bugfix:非 json 请求(文件上传)时,token 过期时,错误读取 request body 问题
This commit is contained in:
parent
075157417c
commit
fd832e23fd
|
@ -93,11 +93,19 @@ public class ServletUtils {
|
|||
}
|
||||
|
||||
public static String getBody(HttpServletRequest request) {
|
||||
return JakartaServletUtil.getBody(request);
|
||||
// 只有在 json 请求在读取,因为只有 CacheRequestBodyFilter 才会进行缓存,支持重复读取
|
||||
if (isJsonRequest(request)) {
|
||||
return JakartaServletUtil.getBody(request);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static byte[] getBodyBytes(HttpServletRequest request) {
|
||||
return JakartaServletUtil.getBodyBytes(request);
|
||||
// 只有在 json 请求在读取,因为只有 CacheRequestBodyFilter 才会进行缓存,支持重复读取
|
||||
if (isJsonRequest(request)) {
|
||||
return JakartaServletUtil.getBodyBytes(request);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String getClientIP(HttpServletRequest request) {
|
||||
|
|
|
@ -6,7 +6,6 @@ DELETE FROM "infra_job_log";
|
|||
DELETE FROM "infra_api_access_log";
|
||||
DELETE FROM "infra_api_error_log";
|
||||
DELETE FROM "infra_file_config";
|
||||
DELETE FROM "infra_test_demo";
|
||||
DELETE FROM "infra_data_source_config";
|
||||
DELETE FROM "infra_codegen_table";
|
||||
DELETE FROM "infra_codegen_column";
|
||||
|
|
|
@ -146,21 +146,6 @@ CREATE TABLE IF NOT EXISTS "infra_api_error_log" (
|
|||
primary key ("id")
|
||||
) COMMENT '系统异常日志';
|
||||
|
||||
CREATE TABLE IF NOT EXISTS "infra_test_demo" (
|
||||
"id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
|
||||
"name" varchar(100) NOT NULL,
|
||||
"status" tinyint NOT NULL,
|
||||
"type" tinyint NOT NULL,
|
||||
"category" tinyint NOT NULL,
|
||||
"remark" varchar(500),
|
||||
"creator" varchar(64) DEFAULT '''',
|
||||
"create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updater" varchar(64) DEFAULT '''',
|
||||
"update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
"deleted" bit NOT NULL DEFAULT FALSE,
|
||||
PRIMARY KEY ("id")
|
||||
) COMMENT '字典类型表';
|
||||
|
||||
CREATE TABLE IF NOT EXISTS "infra_data_source_config" (
|
||||
"id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
|
||||
"name" varchar(100) NOT NULL,
|
||||
|
|
|
@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.system.dal.mysql.oauth2;
|
|||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.oauth2.vo.token.OAuth2AccessTokenPageReqVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.oauth2.OAuth2AccessTokenDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
@ -13,6 +14,7 @@ import java.util.List;
|
|||
@Mapper
|
||||
public interface OAuth2AccessTokenMapper extends BaseMapperX<OAuth2AccessTokenDO> {
|
||||
|
||||
@TenantIgnore // 获取 token 的时候,需要忽略租户编号。原因是:一些场景下,可能不会传递 tenant-id 请求头,例如说文件上传、积木报表等等
|
||||
default OAuth2AccessTokenDO selectByAccessToken(String accessToken) {
|
||||
return selectOne(OAuth2AccessTokenDO::getAccessToken, accessToken);
|
||||
}
|
||||
|
|
|
@ -165,10 +165,11 @@ logging:
|
|||
# 配置自己写的 MyBatis Mapper 打印日志
|
||||
cn.iocoder.yudao.module.bpm.dal.mysql: debug
|
||||
cn.iocoder.yudao.module.infra.dal.mysql: debug
|
||||
cn.iocoder.yudao.module.infra.dal.mysql.logger.ApiErrorLogMapper: INFO # 配置 ApiErrorLogMapper 的日志级别为 info,避免和 GlobalExceptionHandler 重复打印
|
||||
cn.iocoder.yudao.module.infra.dal.mysql.job.JobLogMapper: INFO # 配置 JobLogMapper 的日志级别为 info
|
||||
cn.iocoder.yudao.module.infra.dal.mysql.file.FileConfigMapper: INFO # 配置 FileConfigMapper 的日志级别为 info
|
||||
cn.iocoder.yudao.module.pay.dal.mysql: debug
|
||||
cn.iocoder.yudao.module.pay.dal.mysql.notify.PayNotifyTaskMapper: INFO # 配置 JobLogMapper 的日志级别为 info
|
||||
cn.iocoder.yudao.module.pay.dal.mysql.notify.PayNotifyTaskMapper: INFO # 配置 PayNotifyTaskMapper 的日志级别为 info
|
||||
cn.iocoder.yudao.module.system.dal.mysql: debug
|
||||
cn.iocoder.yudao.module.system.dal.mysql.sms.SmsChannelMapper: INFO # 配置 SmsChannelMapper 的日志级别为 info
|
||||
cn.iocoder.yudao.module.tool.dal.mysql: debug
|
||||
|
|
|
@ -211,7 +211,6 @@ yudao:
|
|||
- system_notify_template
|
||||
- infra_codegen_column
|
||||
- infra_codegen_table
|
||||
- infra_test_demo
|
||||
- infra_config
|
||||
- infra_file_config
|
||||
- infra_file
|
||||
|
|
Loading…
Reference in New Issue