perf: 调整token校验

This commit is contained in:
曾文豪
2023-03-14 14:20:23 +08:00
parent cab794ecc4
commit af50468743
3 changed files with 9 additions and 8 deletions

View File

@@ -41,7 +41,6 @@ public class TestController {
@RequestMapping("/index")
@TokenIgnore
public ApiResp<String> index() {
TokenBean tokenBean = new TokenBean("11", "", "fdfd");
@@ -67,7 +66,6 @@ public class TestController {
@RequestMapping("/export")
@TokenIgnore
public ApiResp<String> export() {
// List<TestFile> list = new ArrayList<>();

View File

@@ -20,3 +20,7 @@ spring:
logging:
file:
name: runtime/logs/tiesheng.log
tiesheng:
token:
ignore-paths:
- /test/index

View File

@@ -1,6 +1,5 @@
package com.tiesheng.login.config.token;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjUtil;
import cn.hutool.core.util.StrUtil;
import com.tiesheng.annotation.token.TokenIgnore;
@@ -55,12 +54,12 @@ public class TsTokenAspect {
String[] ignorePaths = tsTokenConfig.getIgnorePaths();
if (ObjUtil.isNotEmpty(ignorePaths)) {
for (String path : ignorePaths) {
if (path.contains("/**")) {
path = path.replace("/**", "");
if (StrUtil.startWith(requestURI, path)) {
return;
}
if (path.contains("/**") &&
StrUtil.startWith(requestURI, path.replace("/**", ""))) {
// 通配路径
return;
} else if (requestURI.equals(path)) {
// 完整路径
return;
}
}