perf: 调整token校验
This commit is contained in:
@@ -41,7 +41,6 @@ public class TestController {
|
|||||||
|
|
||||||
|
|
||||||
@RequestMapping("/index")
|
@RequestMapping("/index")
|
||||||
@TokenIgnore
|
|
||||||
public ApiResp<String> index() {
|
public ApiResp<String> index() {
|
||||||
|
|
||||||
TokenBean tokenBean = new TokenBean("11", "", "fdfd");
|
TokenBean tokenBean = new TokenBean("11", "", "fdfd");
|
||||||
@@ -67,7 +66,6 @@ public class TestController {
|
|||||||
|
|
||||||
|
|
||||||
@RequestMapping("/export")
|
@RequestMapping("/export")
|
||||||
@TokenIgnore
|
|
||||||
public ApiResp<String> export() {
|
public ApiResp<String> export() {
|
||||||
|
|
||||||
// List<TestFile> list = new ArrayList<>();
|
// List<TestFile> list = new ArrayList<>();
|
||||||
|
|||||||
@@ -20,3 +20,7 @@ spring:
|
|||||||
logging:
|
logging:
|
||||||
file:
|
file:
|
||||||
name: runtime/logs/tiesheng.log
|
name: runtime/logs/tiesheng.log
|
||||||
|
tiesheng:
|
||||||
|
token:
|
||||||
|
ignore-paths:
|
||||||
|
- /test/index
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package com.tiesheng.login.config.token;
|
package com.tiesheng.login.config.token;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
|
||||||
import cn.hutool.core.util.ObjUtil;
|
import cn.hutool.core.util.ObjUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.tiesheng.annotation.token.TokenIgnore;
|
import com.tiesheng.annotation.token.TokenIgnore;
|
||||||
@@ -55,12 +54,12 @@ public class TsTokenAspect {
|
|||||||
String[] ignorePaths = tsTokenConfig.getIgnorePaths();
|
String[] ignorePaths = tsTokenConfig.getIgnorePaths();
|
||||||
if (ObjUtil.isNotEmpty(ignorePaths)) {
|
if (ObjUtil.isNotEmpty(ignorePaths)) {
|
||||||
for (String path : ignorePaths) {
|
for (String path : ignorePaths) {
|
||||||
if (path.contains("/**")) {
|
if (path.contains("/**") &&
|
||||||
path = path.replace("/**", "");
|
StrUtil.startWith(requestURI, path.replace("/**", ""))) {
|
||||||
if (StrUtil.startWith(requestURI, path)) {
|
// 通配路径
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
} else if (requestURI.equals(path)) {
|
} else if (requestURI.equals(path)) {
|
||||||
|
// 完整路径
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user