修改 过滤不要需要验证的接口(path)

This commit is contained in:
‘毛文春’
2023-03-14 14:01:11 +08:00
parent cbfeb09a22
commit 60dea50e43

View File

@@ -1,5 +1,7 @@
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;
import com.tiesheng.util.ServletKit;
@@ -50,14 +52,17 @@ public class TsTokenAspect {
// 过滤不要需要验证的接口path
String requestURI = ServletKit.getRequest().getRequestURI();
for (String path : tsTokenConfig.getIgnorePaths()) {
if (path.contains("/**")) {
path = path.replace("/**", "");
if (StrUtil.startWith(requestURI, path)) {
String[] ignorePaths = tsTokenConfig.getIgnorePaths();
if (ObjUtil.isNotEmpty(ignorePaths)) {
for (String path : ignorePaths) {
if (path.contains("/**")) {
path = path.replace("/**", "");
if (StrUtil.startWith(requestURI, path)) {
return;
}
} else if (requestURI.equals(path)) {
return;
}
} else if (requestURI.equals(path)) {
return;
}
}