mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
处理网关header传递中文异常
This commit is contained in:
+5
-4
@@ -32,7 +32,7 @@ public class DefaultDBFieldHandler implements MetaObjectHandler {
|
|||||||
baseDO.setUpdateTime(current);
|
baseDO.setUpdateTime(current);
|
||||||
}
|
}
|
||||||
|
|
||||||
Long userId = WebFrameworkUtils.getLoginUserId();
|
//Long userId = WebFrameworkUtils.getLoginUserId();
|
||||||
String loginUserName = WebFrameworkUtils.getLoginUserName();
|
String loginUserName = WebFrameworkUtils.getLoginUserName();
|
||||||
// 当前登录用户不为空,创建人为空,则当前登录用户为创建人
|
// 当前登录用户不为空,创建人为空,则当前登录用户为创建人
|
||||||
if (Objects.nonNull(loginUserName) && Objects.isNull(baseDO.getCreator())) {
|
if (Objects.nonNull(loginUserName) && Objects.isNull(baseDO.getCreator())) {
|
||||||
@@ -55,9 +55,10 @@ public class DefaultDBFieldHandler implements MetaObjectHandler {
|
|||||||
|
|
||||||
// 当前登录用户不为空,更新人为空,则当前登录用户为更新人
|
// 当前登录用户不为空,更新人为空,则当前登录用户为更新人
|
||||||
Object modifier = getFieldValByName("updater", metaObject);
|
Object modifier = getFieldValByName("updater", metaObject);
|
||||||
Long userId = WebFrameworkUtils.getLoginUserId();
|
//Long userId = WebFrameworkUtils.getLoginUserId();
|
||||||
if (Objects.nonNull(userId) && Objects.isNull(modifier)) {
|
String loginUserName = WebFrameworkUtils.getLoginUserName();
|
||||||
setFieldValByName("updater", userId.toString(), metaObject);
|
if (Objects.nonNull(loginUserName) && Objects.isNull(modifier)) {
|
||||||
|
setFieldValByName("updater", loginUserName, metaObject);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+8
@@ -19,6 +19,8 @@ import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
|||||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||||
import org.springframework.security.web.AuthenticationEntryPoint;
|
import org.springframework.security.web.AuthenticationEntryPoint;
|
||||||
import org.springframework.security.web.access.AccessDeniedHandler;
|
import org.springframework.security.web.access.AccessDeniedHandler;
|
||||||
|
import org.springframework.security.web.firewall.DefaultHttpFirewall;
|
||||||
|
import org.springframework.security.web.firewall.HttpFirewall;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
@@ -100,4 +102,10 @@ public class ChenfengSecurityAutoConfiguration {
|
|||||||
return methodInvokingFactoryBean;
|
return methodInvokingFactoryBean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public HttpFirewall httpFirewall() {
|
||||||
|
return new DefaultHttpFirewall();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+3
@@ -23,6 +23,8 @@ import javax.servlet.ServletException;
|
|||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.net.URLDecoder;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Token 过滤器,验证 token 的有效性
|
* Token 过滤器,验证 token 的有效性
|
||||||
@@ -133,6 +135,7 @@ public class TokenAuthenticationFilter extends OncePerRequestFilter {
|
|||||||
LoginUser loginUser = JsonUtils.parseObject(loginUserStr, LoginUser.class);
|
LoginUser loginUser = JsonUtils.parseObject(loginUserStr, LoginUser.class);
|
||||||
CommonResult<Boolean> superAdmin = permissionApi.hasAnyRoles(loginUser.getId(), "super_admin");
|
CommonResult<Boolean> superAdmin = permissionApi.hasAnyRoles(loginUser.getId(), "super_admin");
|
||||||
loginUser.setIsSupAdmin(superAdmin.getCheckedData());
|
loginUser.setIsSupAdmin(superAdmin.getCheckedData());
|
||||||
|
loginUser.setNickname(URLDecoder.decode(loginUser.getNickname(),StandardCharsets.UTF_8));
|
||||||
return loginUser;
|
return loginUser;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
+4
-1
@@ -22,6 +22,9 @@ import org.springframework.web.reactive.function.client.WebClient;
|
|||||||
import org.springframework.web.server.ServerWebExchange;
|
import org.springframework.web.server.ServerWebExchange;
|
||||||
import reactor.core.publisher.Mono;
|
import reactor.core.publisher.Mono;
|
||||||
|
|
||||||
|
import java.net.URLEncoder;
|
||||||
|
import java.nio.charset.Charset;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
@@ -171,7 +174,7 @@ public class TokenAuthenticationFilter implements GlobalFilter, Ordered {
|
|||||||
return new LoginUser().setId(tokenInfo.getUserId()).setUserType(tokenInfo.getUserType())
|
return new LoginUser().setId(tokenInfo.getUserId()).setUserType(tokenInfo.getUserType())
|
||||||
.setOrganId(tokenInfo.getOrganId()).setScopes(tokenInfo.getScopes())
|
.setOrganId(tokenInfo.getOrganId()).setScopes(tokenInfo.getScopes())
|
||||||
.setLarge(tokenInfo.getLarge()).setDbNo(tokenInfo.getDbNo()).setTableNo(tokenInfo.getTableNo())
|
.setLarge(tokenInfo.getLarge()).setDbNo(tokenInfo.getDbNo()).setTableNo(tokenInfo.getTableNo())
|
||||||
.setDataCode(tokenInfo.getDataCode()).setNickname(tokenInfo.getNickname());
|
.setDataCode(tokenInfo.getDataCode()).setNickname(URLEncoder.encode(tokenInfo.getNickname(), StandardCharsets.UTF_8));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user