|
|
@@ -1,11 +1,10 @@
|
|
|
package com.sckw.core.filter;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.sckw.core.config.CustomConfig;
|
|
|
import com.sckw.core.exception.SystemException;
|
|
|
-import com.sckw.core.model.auth.UserAccessMenuInfo;
|
|
|
import com.sckw.core.model.constant.CacheGroup;
|
|
|
import com.sckw.core.model.constant.Global;
|
|
|
-import com.sckw.core.utils.CollectionUtils;
|
|
|
import com.sckw.core.utils.EncryUtil;
|
|
|
import com.sckw.core.utils.StringUtils;
|
|
|
import com.sckw.core.web.constant.HttpStatus;
|
|
|
@@ -13,8 +12,11 @@ import com.sckw.core.web.constant.RequestConstant;
|
|
|
import com.sckw.core.web.context.LoginUserHolder;
|
|
|
import com.sckw.core.web.model.LoginUserInfo;
|
|
|
import com.sckw.redis.utils.RedissonUtils;
|
|
|
+import jakarta.annotation.PostConstruct;
|
|
|
import jakarta.servlet.*;
|
|
|
import jakarta.servlet.http.HttpServletRequest;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
import java.io.IOException;
|
|
|
@@ -33,11 +35,19 @@ public class LoginFilter implements Filter {
|
|
|
|
|
|
private static final List<String> EXCLUDEPATH = new ArrayList<>();
|
|
|
|
|
|
- static {
|
|
|
- EXCLUDEPATH.add("/auth/login");
|
|
|
- EXCLUDEPATH.add("/kwsUser/resetPassword");
|
|
|
- EXCLUDEPATH.add("/kwsUser/updatePassword");
|
|
|
- EXCLUDEPATH.add("/kwsUser/forgetPassword");
|
|
|
+ @Autowired
|
|
|
+ CustomConfig customConfig;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @desc: 初始化放行路径
|
|
|
+ * @author: czh
|
|
|
+ */
|
|
|
+ @PostConstruct
|
|
|
+ private void initExcludePath() {
|
|
|
+ String links = customConfig.getLinks();
|
|
|
+ if (StringUtils.isNotBlank(links)) {
|
|
|
+ EXCLUDEPATH.addAll(Arrays.asList(links.split(",")));
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -89,20 +99,4 @@ public class LoginFilter implements Filter {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private List<String> getMenus(String key) {
|
|
|
- List<String> links = new ArrayList<>();
|
|
|
- Object menuObject = RedissonUtils.get(CacheGroup.ACCESSMENU + key);
|
|
|
- if (!Objects.isNull(menuObject)) {
|
|
|
- List<UserAccessMenuInfo> userAccessMenuInfos = JSONObject.parseArray(menuObject.toString(), UserAccessMenuInfo.class);
|
|
|
- if (!CollectionUtils.isEmpty(userAccessMenuInfos)) {
|
|
|
- for (UserAccessMenuInfo userAccessMenuInfo : userAccessMenuInfos) {
|
|
|
- String links1 = userAccessMenuInfo.getLinks();
|
|
|
- links.addAll(Arrays.asList(links1.split(",")));
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- links.add("/kwsMenu/add");
|
|
|
- return links;
|
|
|
- }
|
|
|
-
|
|
|
}
|