fix: iot-openapi 权限拦截
parent
a60fa98640
commit
81b72b5693
|
@ -11,6 +11,9 @@ import org.springframework.context.annotation.Configuration;
|
|||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* sa-token 配置
|
||||
*
|
||||
|
@ -39,8 +42,20 @@ public class SaTokenConfig implements WebMvcConfigurer {
|
|||
@Override
|
||||
public void addInterceptors(InterceptorRegistry registry) {
|
||||
// 注册 Sa-Token 拦截器,校验规则为 StpUtil.checkLogin() 登录校验。
|
||||
|
||||
List<String> swaggerUrls = List.of("/doc.html","/favicon.ico", "/webjars/**", "/resources/**"
|
||||
, "/swagger-resources/**", "/swagger-ui.html/**");
|
||||
|
||||
List loginUrls = List.of("/code", "/auth/tenant/list", "/auth/login");
|
||||
List<String> openApiUrls = List.of( "/openapi/v1/getToken");
|
||||
|
||||
List<String> excludeUrls = new ArrayList<>();
|
||||
excludeUrls.addAll(loginUrls);
|
||||
excludeUrls.addAll(swaggerUrls);
|
||||
excludeUrls.addAll(openApiUrls);
|
||||
|
||||
registry.addInterceptor(new SaInterceptor(handle -> StpUtil.checkLogin()))
|
||||
.addPathPatterns("/**")
|
||||
.excludePathPatterns("/code", "/auth/tenant/list", "/auth/login");
|
||||
.excludePathPatterns(excludeUrls);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,36 +13,12 @@
|
|||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.bouncycastle</groupId>
|
||||
<artifactId>bcprov-jdk15on</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.aliyun.oss</groupId>
|
||||
<artifactId>aliyun-sdk-oss</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>joda-time</groupId>
|
||||
<artifactId>joda-time</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>it.ozimov</groupId>
|
||||
<artifactId>embedded-redis</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>slf4j-simple</artifactId>
|
||||
<groupId>org.slf4j</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cc.iotkit</groupId>
|
||||
|
@ -59,20 +35,6 @@
|
|||
<artifactId>iot-rule-engine</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cc.iotkit</groupId>
|
||||
<artifactId>iot-screen</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cc.iotkit</groupId>
|
||||
<artifactId>iot-component-server</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cc.iotkit</groupId>
|
||||
<artifactId>iot-component-converter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cc.iotkit</groupId>
|
||||
|
|
|
@ -4,7 +4,6 @@ import cc.iotkit.common.api.Request;
|
|||
import cc.iotkit.model.InvokeResult;
|
||||
import cc.iotkit.openapi.dto.bo.TokenVerifyBo;
|
||||
import cc.iotkit.openapi.service.OpenBaseService;
|
||||
import cc.iotkit.openapi.service.OpenDeviceService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
|
|
@ -166,6 +166,10 @@
|
|||
<groupId>cc.iotkit</groupId>
|
||||
<artifactId>iot-generator</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cc.iotkit</groupId>
|
||||
<artifactId>iot-openapi</artifactId>
|
||||
</dependency>
|
||||
<!-- <dependency>
|
||||
<groupId>cc.iotkit</groupId>
|
||||
<artifactId>iot-baetyl</artifactId>
|
||||
|
|
6
pom.xml
6
pom.xml
|
@ -550,6 +550,12 @@
|
|||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cc.iotkit</groupId>
|
||||
<artifactId>iot-openapi</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cc.iotkit</groupId>
|
||||
<artifactId>iot-baetyl</artifactId>
|
||||
|
|
Loading…
Reference in New Issue