|
@@ -3,7 +3,6 @@ package com.xiaoan.web.shiro;
|
|
|
import com.alibaba.fastjson.serializer.SerializerFeature;
|
|
|
import com.alibaba.fastjson.support.config.FastJsonConfig;
|
|
|
import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter;
|
|
|
-import com.xiaoan.common.util.FileUtils;
|
|
|
import lombok.extern.log4j.Log4j2;
|
|
|
import org.apache.shiro.mgt.DefaultSessionStorageEvaluator;
|
|
|
import org.apache.shiro.mgt.DefaultSubjectDAO;
|
|
@@ -19,8 +18,6 @@ import org.springframework.context.annotation.DependsOn;
|
|
|
import org.springframework.http.MediaType;
|
|
|
|
|
|
import javax.servlet.Filter;
|
|
|
-import java.io.FileInputStream;
|
|
|
-import java.io.IOException;
|
|
|
import java.util.*;
|
|
|
|
|
|
@Log4j2
|
|
@@ -83,14 +80,6 @@ public class ShiroConfig {
|
|
|
filterRuleMap.put("/v2/**", "anon");
|
|
|
filterRuleMap.put("/swagger-ui.html/**", "anon");
|
|
|
|
|
|
-// String active = getValue("spring.profiles.active");
|
|
|
-// log.info("active: {}", active);
|
|
|
-////
|
|
|
-//// // 正式环境拦截swagger
|
|
|
-// if ("sit".equals(active)) {
|
|
|
-// filterRuleMap.put("/doc.html", "jwt");
|
|
|
-//// filterRuleMap.put("/**/doc.html", "jwt");
|
|
|
-// }
|
|
|
|
|
|
// 所有请求通过我们自己的JWT Filter
|
|
|
filterRuleMap.put("/api/manage/**", "jwt");
|
|
@@ -165,30 +154,6 @@ public class ShiroConfig {
|
|
|
|
|
|
|
|
|
|
|
|
- /**
|
|
|
- * 读取配置文件值
|
|
|
- * @param key : 配置文件key
|
|
|
- * @return
|
|
|
- */
|
|
|
- public String getValue(String key){
|
|
|
- log.info("run getValue");
|
|
|
- log.info("key: {}", key);
|
|
|
- Properties prop = new Properties();
|
|
|
-
|
|
|
- // 需要用这这方式获取路径,有些方式放到tomcat不灵
|
|
|
- String resource = FileUtils.getResource("application.properties");
|
|
|
- log.info("path: {}", resource);
|
|
|
- FileInputStream in = null;
|
|
|
- try {
|
|
|
- in = new FileInputStream(resource);
|
|
|
- prop.load(in);
|
|
|
- } catch (IOException e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- String property = prop.getProperty(key);
|
|
|
- log.info("value: {}", property);
|
|
|
- return prop.getProperty(key);
|
|
|
- }
|
|
|
|
|
|
|
|
|
}
|