From d045534be6300b5ac3f236e114a69a6b0b31edcc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9B=BE=E6=96=87=E8=B1=AA?= <980287353@qq.com> Date: Sun, 26 Feb 2023 11:09:05 +0800 Subject: [PATCH] =?UTF-8?q?perf=EF=BC=9B=E8=B0=83=E6=95=B4TsTokenConfig?= =?UTF-8?q?=E4=B8=AD=E7=9A=84ignores?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 4 ++++ README.md | 4 ++++ .../src/main/resources/application-test.yml | 2 +- .../login/config/token/TsTokenConfig.java | 18 +++++++++--------- 4 files changed, 18 insertions(+), 10 deletions(-) create mode 100644 CHANGELOG.md create mode 100644 README.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..6c85616 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,4 @@ +### 0.7.3 + +> 增加:TsTokenConfig增加新的属性**ignorePaths**,用于通过路径忽略token; +> 调整:TsTokenConfig中的**ignores**属性调整为**testMap**; diff --git a/README.md b/README.md new file mode 100644 index 0000000..7cf6815 --- /dev/null +++ b/README.md @@ -0,0 +1,4 @@ +## 杭州铁晟科技有限公司基础项目 + +更新日志可点击查看[changelog](./CHANGELOG.md ':include') + diff --git a/springboot-ademo/src/main/resources/application-test.yml b/springboot-ademo/src/main/resources/application-test.yml index 457043a..9a556e3 100644 --- a/springboot-ademo/src/main/resources/application-test.yml +++ b/springboot-ademo/src/main/resources/application-test.yml @@ -16,7 +16,7 @@ platform: tiesheng: token: - ignores: + test-map: "1111": id: "1111" global: diff --git a/springboot-login/src/main/java/com/tiesheng/login/config/token/TsTokenConfig.java b/springboot-login/src/main/java/com/tiesheng/login/config/token/TsTokenConfig.java index c9a5d51..773e848 100644 --- a/springboot-login/src/main/java/com/tiesheng/login/config/token/TsTokenConfig.java +++ b/springboot-login/src/main/java/com/tiesheng/login/config/token/TsTokenConfig.java @@ -23,7 +23,7 @@ import java.util.Map; @ConfigurationProperties("tiesheng.token") public class TsTokenConfig { - private Map ignores = MapUtil.newHashMap(); + private Map testMap = MapUtil.newHashMap(); private String encryptKey = "%kIp9frQCu"; private Integer expireHours = 48; private String[] ignorePaths; @@ -57,11 +57,11 @@ public class TsTokenConfig { * @param token * @return */ - public TokenBean isIgnored(String token) { - if (ignores == null) { + public TokenBean isTestToken(String token) { + if (testMap == null) { return null; } - return ignores.get(token); + return testMap.get(token); } @@ -83,7 +83,7 @@ public class TsTokenConfig { * @return */ public TokenBean validToken(String token, boolean thrExp) { - TokenBean tokenBean = isIgnored(token); + TokenBean tokenBean = isTestToken(token); if (tokenBean != null) { return tokenBean; } @@ -116,12 +116,12 @@ public class TsTokenConfig { // setter\getter /////////////////////////////////////////////////////////////////////////// - public Map getIgnores() { - return ignores; + public Map getTestMap() { + return testMap; } - public void setIgnores(Map ignores) { - this.ignores = ignores; + public void setTestMap(Map testMap) { + this.testMap = testMap; } public String getEncryptKey() {