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.InterceptorRegistry;
|
||||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* sa-token 配置
|
* sa-token 配置
|
||||||
*
|
*
|
||||||
|
@ -39,8 +42,20 @@ public class SaTokenConfig implements WebMvcConfigurer {
|
||||||
@Override
|
@Override
|
||||||
public void addInterceptors(InterceptorRegistry registry) {
|
public void addInterceptors(InterceptorRegistry registry) {
|
||||||
// 注册 Sa-Token 拦截器,校验规则为 StpUtil.checkLogin() 登录校验。
|
// 注册 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()))
|
registry.addInterceptor(new SaInterceptor(handle -> StpUtil.checkLogin()))
|
||||||
.addPathPatterns("/**")
|
.addPathPatterns("/**")
|
||||||
.excludePathPatterns("/code", "/auth/tenant/list", "/auth/login");
|
.excludePathPatterns(excludeUrls);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,36 +13,12 @@
|
||||||
|
|
||||||
<dependencies>
|
<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>
|
<dependency>
|
||||||
<groupId>joda-time</groupId>
|
<groupId>joda-time</groupId>
|
||||||
<artifactId>joda-time</artifactId>
|
<artifactId>joda-time</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>it.ozimov</groupId>
|
|
||||||
<artifactId>embedded-redis</artifactId>
|
|
||||||
<exclusions>
|
|
||||||
<exclusion>
|
|
||||||
<artifactId>slf4j-simple</artifactId>
|
|
||||||
<groupId>org.slf4j</groupId>
|
|
||||||
</exclusion>
|
|
||||||
</exclusions>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>cc.iotkit</groupId>
|
<groupId>cc.iotkit</groupId>
|
||||||
|
@ -59,20 +35,6 @@
|
||||||
<artifactId>iot-rule-engine</artifactId>
|
<artifactId>iot-rule-engine</artifactId>
|
||||||
</dependency>
|
</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>
|
<dependency>
|
||||||
<groupId>cc.iotkit</groupId>
|
<groupId>cc.iotkit</groupId>
|
||||||
|
|
|
@ -4,7 +4,6 @@ import cc.iotkit.common.api.Request;
|
||||||
import cc.iotkit.model.InvokeResult;
|
import cc.iotkit.model.InvokeResult;
|
||||||
import cc.iotkit.openapi.dto.bo.TokenVerifyBo;
|
import cc.iotkit.openapi.dto.bo.TokenVerifyBo;
|
||||||
import cc.iotkit.openapi.service.OpenBaseService;
|
import cc.iotkit.openapi.service.OpenBaseService;
|
||||||
import cc.iotkit.openapi.service.OpenDeviceService;
|
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
|
@ -166,6 +166,10 @@
|
||||||
<groupId>cc.iotkit</groupId>
|
<groupId>cc.iotkit</groupId>
|
||||||
<artifactId>iot-generator</artifactId>
|
<artifactId>iot-generator</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>cc.iotkit</groupId>
|
||||||
|
<artifactId>iot-openapi</artifactId>
|
||||||
|
</dependency>
|
||||||
<!-- <dependency>
|
<!-- <dependency>
|
||||||
<groupId>cc.iotkit</groupId>
|
<groupId>cc.iotkit</groupId>
|
||||||
<artifactId>iot-baetyl</artifactId>
|
<artifactId>iot-baetyl</artifactId>
|
||||||
|
|
6
pom.xml
6
pom.xml
|
@ -550,6 +550,12 @@
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>cc.iotkit</groupId>
|
||||||
|
<artifactId>iot-openapi</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>cc.iotkit</groupId>
|
<groupId>cc.iotkit</groupId>
|
||||||
<artifactId>iot-baetyl</artifactId>
|
<artifactId>iot-baetyl</artifactId>
|
||||||
|
|
Loading…
Reference in New Issue