diff --git a/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/core/filter/TokenAuthenticationFilter.java b/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/core/filter/TokenAuthenticationFilter.java index 29907a6a1..e87f5bc44 100644 --- a/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/core/filter/TokenAuthenticationFilter.java +++ b/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/core/filter/TokenAuthenticationFilter.java @@ -37,34 +37,13 @@ public class TokenAuthenticationFilter extends OncePerRequestFilter { private final OAuth2TokenApi oauth2TokenApi; - /** - * 积木报表内部请求获取token - * - * @param request - * @return - */ - private static String getToken(HttpServletRequest request) { - String token = request.getParameter("token"); - if (token == null) { - token = request.getHeader("X-Access-Token"); - } - return token; - } - @Override @SuppressWarnings("NullableProblems") protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws ServletException, IOException { - String token; - Integer userType; - if (request.getRequestURI().startsWith("/jmreport/")) { - token = getToken(request); - userType = 2; - } else { - token = SecurityFrameworkUtils.obtainAuthorization(request, securityProperties.getTokenHeader()); - userType = WebFrameworkUtils.getLoginUserType(request); - } + String token = SecurityFrameworkUtils.obtainAuthorization(request, securityProperties.getTokenHeader()); if (StrUtil.isNotEmpty(token)) { + Integer userType = WebFrameworkUtils.getLoginUserType(request); try { // 1.1 基于 token 构建登录用户 LoginUser loginUser = buildLoginUserByToken(token, userType); @@ -109,11 +88,11 @@ public class TokenAuthenticationFilter extends OncePerRequestFilter { /** * 模拟登录用户,方便日常开发调试 - *
+ *
* 注意,在线上环境下,一定要关闭该功能!!!
*
- * @param request 请求
- * @param token 模拟的 token,格式为 {@link SecurityProperties#getMockSecret()} + 用户编号
+ * @param request 请求
+ * @param token 模拟的 token,格式为 {@link SecurityProperties#getMockSecret()} + 用户编号
* @param userType 用户类型
* @return 模拟的 LoginUser
*/
diff --git a/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/core/util/SecurityFrameworkUtils.java b/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/core/util/SecurityFrameworkUtils.java
index a64f4aafd..5dc17b626 100644
--- a/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/core/util/SecurityFrameworkUtils.java
+++ b/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/core/util/SecurityFrameworkUtils.java
@@ -24,20 +24,6 @@ public class SecurityFrameworkUtils {
private SecurityFrameworkUtils() {}
- /**
- * 积木报表内部请求获取token
- *
- * @param request
- * @return
- */
- private static String getToken(HttpServletRequest request) {
- String token = request.getParameter("token");
- if (token == null) {
- token = request.getHeader("X-Access-Token");
- }
- return token;
- }
-
/**
* 从请求中,获得认证 Token
*
@@ -46,9 +32,6 @@ public class SecurityFrameworkUtils {
* @return 认证 Token
*/
public static String obtainAuthorization(HttpServletRequest request, String header) {
- if (request.getRequestURI().startsWith("/jmreport/")) {
- return getToken(request);
- }
String authorization = request.getHeader(header);
if (!StringUtils.hasText(authorization)) {
return null;
diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/framework/security/config/SecurityConfiguration.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/framework/security/config/SecurityConfiguration.java
index 7f671f319..f581fa102 100644
--- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/framework/security/config/SecurityConfiguration.java
+++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/framework/security/config/SecurityConfiguration.java
@@ -27,6 +27,8 @@ public class SecurityConfiguration {
.antMatchers("/swagger-resources/**").anonymous()
.antMatchers("/webjars/**").anonymous()
.antMatchers("/*/api-docs").anonymous();
+ //积木报表
+ registry.antMatchers("/jmreport/**").permitAll();
// Spring Boot Actuator 的安全配置
registry.antMatchers("/actuator").anonymous()
.antMatchers("/actuator/**").anonymous();
diff --git a/yudao-module-visualization/yudao-module-visualization-biz/pom.xml b/yudao-module-visualization/yudao-module-visualization-biz/pom.xml
index afd301de1..478079e28 100644
--- a/yudao-module-visualization/yudao-module-visualization-biz/pom.xml
+++ b/yudao-module-visualization/yudao-module-visualization-biz/pom.xml
@@ -23,6 +23,12 @@