From f1981d1baab74d55252c75b77e29dba43b277fee Mon Sep 17 00:00:00 2001 From: CaptainB Date: Thu, 29 Feb 2024 15:36:59 +0800 Subject: [PATCH] ci: shiro redisson version --- backend/services/system-setting/pom.xml | 20 +++++++++++++++++++ .../system/config/ShiroConfig.java | 16 ++++----------- .../RestControllerExceptionHandler.java | 9 ++++++--- pom.xml | 4 ++-- 4 files changed, 32 insertions(+), 17 deletions(-) diff --git a/backend/services/system-setting/pom.xml b/backend/services/system-setting/pom.xml index d3c53080e3..ff6cf7357d 100644 --- a/backend/services/system-setting/pom.xml +++ b/backend/services/system-setting/pom.xml @@ -30,6 +30,26 @@ ${quartz-starter.version} + + org.apache.shiro + shiro-spring-boot-web-starter + ${shiro.version} + jakarta + + + org.apache.shiro + shiro-spring-boot-starter + + + org.apache.shiro + shiro-web + + + org.apache.shiro + shiro-spring + + + org.apache.shiro shiro-spring-boot-starter diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/config/ShiroConfig.java b/backend/services/system-setting/src/main/java/io/metersphere/system/config/ShiroConfig.java index 7453f7ae38..8bd1402e95 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/config/ShiroConfig.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/config/ShiroConfig.java @@ -1,13 +1,11 @@ package io.metersphere.system.config; +import io.metersphere.sdk.util.FilterChainUtils; import io.metersphere.system.security.ApiKeyFilter; import io.metersphere.system.security.CsrfFilter; import io.metersphere.system.security.MsPermissionAnnotationMethodInterceptor; import io.metersphere.system.security.realm.LocalRealm; -import io.metersphere.sdk.util.FilterChainUtils; -import jakarta.servlet.DispatcherType; -import jakarta.servlet.Filter; import org.apache.shiro.aop.AnnotationResolver; import org.apache.shiro.authz.aop.*; import org.apache.shiro.cache.CacheManager; @@ -22,12 +20,13 @@ import org.apache.shiro.spring.web.ShiroFilterFactoryBean; import org.apache.shiro.web.mgt.DefaultWebSecurityManager; import org.apache.shiro.web.session.mgt.ServletContainerSessionManager; import org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator; -import org.springframework.boot.web.servlet.FilterRegistrationBean; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.DependsOn; -import java.util.*; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; @Configuration public class ShiroConfig { @@ -54,13 +53,6 @@ public class ShiroConfig { return shiroFilterFactoryBean; } - @Bean(name = "shiroFilter") - public FilterRegistrationBean shiroFilter(ShiroFilterFactoryBean shiroFilterFactoryBean) throws Exception { - FilterRegistrationBean registration = new FilterRegistrationBean<>(); - registration.setFilter((Filter) Objects.requireNonNull(shiroFilterFactoryBean.getObject())); - registration.setDispatcherTypes(EnumSet.allOf(DispatcherType.class)); - return registration; - } @Bean public MemoryConstrainedCacheManager memoryConstrainedCacheManager() { diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/controller/handler/RestControllerExceptionHandler.java b/backend/services/system-setting/src/main/java/io/metersphere/system/controller/handler/RestControllerExceptionHandler.java index 828316c025..1affe5ca15 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/controller/handler/RestControllerExceptionHandler.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/controller/handler/RestControllerExceptionHandler.java @@ -1,15 +1,15 @@ package io.metersphere.system.controller.handler; import io.metersphere.sdk.exception.IResultCode; -import io.metersphere.system.controller.handler.result.MsHttpResultCode; import io.metersphere.sdk.exception.MSException; -import io.metersphere.system.utils.ServiceUtils; import io.metersphere.sdk.util.Translator; +import io.metersphere.system.controller.handler.result.MsHttpResultCode; +import io.metersphere.system.utils.ServiceUtils; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; import org.apache.commons.lang3.StringUtils; -import org.apache.shiro.ShiroException; import org.apache.shiro.authz.UnauthorizedException; +import org.apache.shiro.lang.ShiroException; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.validation.FieldError; @@ -51,6 +51,7 @@ public class RestControllerExceptionHandler { /** * http 状态码返回405 + * * @param exception 异常信息 * @return */ @@ -96,6 +97,7 @@ public class RestControllerExceptionHandler { /** * 当抛出 NOT_FOUND,拼接资源名称 + * * @param message * @return */ @@ -134,6 +136,7 @@ public class RestControllerExceptionHandler { /** * 格式化异常信息 * 当出现未知异常时,将错误栈信息格式化返回 + * * @param e * @return */ diff --git a/pom.xml b/pom.xml index 436b00f45e..15773e5f2d 100644 --- a/pom.xml +++ b/pom.xml @@ -21,7 +21,7 @@ 3.x 21 1.5.0 - 1.13.0 + 2.0.0 1.5.4 3.3.3 2.1.4 @@ -30,7 +30,7 @@ 3.0 1.0.2 1.0.7 - 3.27.0 + 3.27.1 3.0.3 0.10.2 2.15.1