perf;调整TsTokenConfig中的ignores

This commit is contained in:
曾文豪
2023-02-26 11:09:05 +08:00
parent 56b923f5db
commit d045534be6
4 changed files with 18 additions and 10 deletions

4
CHANGELOG.md Normal file
View File

@@ -0,0 +1,4 @@
### 0.7.3
> 增加TsTokenConfig增加新的属性**ignorePaths**用于通过路径忽略token
> 调整TsTokenConfig中的**ignores**属性调整为**testMap**

4
README.md Normal file
View File

@@ -0,0 +1,4 @@
## 杭州铁晟科技有限公司基础项目
更新日志可点击查看[changelog](./CHANGELOG.md ':include')

View File

@@ -16,7 +16,7 @@ platform:
tiesheng: tiesheng:
token: token:
ignores: test-map:
"1111": "1111":
id: "1111" id: "1111"
global: global:

View File

@@ -23,7 +23,7 @@ import java.util.Map;
@ConfigurationProperties("tiesheng.token") @ConfigurationProperties("tiesheng.token")
public class TsTokenConfig { public class TsTokenConfig {
private Map<String, TokenBean> ignores = MapUtil.newHashMap(); private Map<String, TokenBean> testMap = MapUtil.newHashMap();
private String encryptKey = "%kIp9frQCu"; private String encryptKey = "%kIp9frQCu";
private Integer expireHours = 48; private Integer expireHours = 48;
private String[] ignorePaths; private String[] ignorePaths;
@@ -57,11 +57,11 @@ public class TsTokenConfig {
* @param token * @param token
* @return * @return
*/ */
public TokenBean isIgnored(String token) { public TokenBean isTestToken(String token) {
if (ignores == null) { if (testMap == null) {
return null; return null;
} }
return ignores.get(token); return testMap.get(token);
} }
@@ -83,7 +83,7 @@ public class TsTokenConfig {
* @return * @return
*/ */
public TokenBean validToken(String token, boolean thrExp) { public TokenBean validToken(String token, boolean thrExp) {
TokenBean tokenBean = isIgnored(token); TokenBean tokenBean = isTestToken(token);
if (tokenBean != null) { if (tokenBean != null) {
return tokenBean; return tokenBean;
} }
@@ -116,12 +116,12 @@ public class TsTokenConfig {
// setter\getter // setter\getter
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
public Map<String, TokenBean> getIgnores() { public Map<String, TokenBean> getTestMap() {
return ignores; return testMap;
} }
public void setIgnores(Map<String, TokenBean> ignores) { public void setTestMap(Map<String, TokenBean> testMap) {
this.ignores = ignores; this.testMap = testMap;
} }
public String getEncryptKey() { public String getEncryptKey() {