From 5da83bb477a49ee9cda0576364ecd6ce4e55eb13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9B=BE=E6=96=87=E8=B1=AA?= <980287353@qq.com> Date: Thu, 11 Jul 2024 15:21:59 +0800 Subject: [PATCH] publish 2.0.0.rc4 --- .DS_Store | Bin 6148 -> 10244 bytes CHANGELOG.md | 93 +---------------- CHANGELOG_V1.md | 94 ++++++++++++++++++ pom.xml | 22 ++-- springboot-ademo/.DS_Store | Bin 6148 -> 6148 bytes springboot-ademo/pom.xml | 4 +- .../src/main/java/com/tiesheng/.DS_Store | Bin 0 -> 6148 bytes .../src/main/java/com/tiesheng/demo/.DS_Store | Bin 0 -> 6148 bytes springboot-annotation/.DS_Store | Bin 0 -> 6148 bytes springboot-annotation/pom.xml | 2 +- springboot-database/.DS_Store | Bin 0 -> 6148 bytes springboot-database/pom.xml | 2 +- springboot-encrypt/.DS_Store | Bin 0 -> 6148 bytes springboot-encrypt/pom.xml | 2 +- springboot-login/.DS_Store | Bin 0 -> 6148 bytes springboot-login/pom.xml | 2 +- .../login/config/TokenWebMvcConfigurer.java | 92 +++++++++++++++++ .../tiesheng/login/config/TsTokenAspect.java | 88 ---------------- springboot-message/.DS_Store | Bin 0 -> 6148 bytes springboot-message/pom.xml | 2 +- springboot-platform/.DS_Store | Bin 0 -> 6148 bytes springboot-platform/pom.xml | 2 +- springboot-poi/.DS_Store | Bin 0 -> 6148 bytes springboot-poi/pom.xml | 2 +- springboot-role/.DS_Store | Bin 0 -> 6148 bytes springboot-role/pom.xml | 2 +- .../role/controller/RoleController.java | 30 +++--- springboot-util/.DS_Store | Bin 0 -> 6148 bytes springboot-util/pom.xml | 2 +- .../tiesheng/util/config/TsTokenConfig.java | 44 ++------ springboot-web/.DS_Store | Bin 0 -> 6148 bytes springboot-web/pom.xml | 2 +- .../web/config/operation/OperationAspect.java | 5 +- 33 files changed, 241 insertions(+), 251 deletions(-) create mode 100644 CHANGELOG_V1.md create mode 100644 springboot-ademo/src/main/java/com/tiesheng/.DS_Store create mode 100644 springboot-ademo/src/main/java/com/tiesheng/demo/.DS_Store create mode 100644 springboot-annotation/.DS_Store create mode 100644 springboot-database/.DS_Store create mode 100644 springboot-encrypt/.DS_Store create mode 100644 springboot-login/.DS_Store create mode 100644 springboot-login/src/main/java/com/tiesheng/login/config/TokenWebMvcConfigurer.java delete mode 100644 springboot-login/src/main/java/com/tiesheng/login/config/TsTokenAspect.java create mode 100644 springboot-message/.DS_Store create mode 100644 springboot-platform/.DS_Store create mode 100644 springboot-poi/.DS_Store create mode 100644 springboot-role/.DS_Store create mode 100644 springboot-util/.DS_Store create mode 100644 springboot-web/.DS_Store diff --git a/.DS_Store b/.DS_Store index da7ffcbbe803a4e2a12714418ca9f5048e1db013..fb8de5d5d9092e0816469a6a86d1fc22b41f44b3 100644 GIT binary patch literal 10244 zcmeHM&5P4O6o0eZbyHT|qAq@%f*+tzb!*+~;sh6VDQ0$mRT@DVWM@szbV{-<)zhIt$pFpSn*l~-}0M{1*?9QA6>Bgm13}e$@84v zzE!+zms?AzEvG%#w`{ju7htY`5gK7QCigYKZ$3;pCclTe2yxZqHK+Q8w;o48WY=}-JVXdu!N_~tEwM3SkwFsORG7tlh3$EVif#h;D&OG z#1UQ-c??mR2Yh#6W*b<8z&QPD4J$kQe)!8{q|ui!Sa4F#i-7{WvLyJ-cFI`VKr zmC4@ZkVynW!6gzkw8urD2%qtvJTEFlQ@j-&k{R|n6^&RUpP(H@b|Rvqd|q%qs(iNa z`B5Zn#tREk{t7N5+fXnWi6K0U3!H~uv;zN+0^^d3IfeENeuyak|NnmoYbII&t-yc+ zEU{Qv+(1Xc#MrF1mXkwV)zH>6A-A%sx~8^n_T+N{^0IT#O+>bBV&SvJ>>M0| n%s@pzAixbITtV*MSoocJGQWx^$QKMu5Fdd&$*?(|XAUy}IKnk{ diff --git a/CHANGELOG.md b/CHANGELOG.md index ac226cb..00778c8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,94 +1,7 @@ -## 1.1.0 +## 2.0.0.rc4 -- feat:globalConfig增加ext属性。 -- feat:增加网络请求超时、重定向的配置。 -- perf:更新数据库对比插件。 -- feat(web):增加DaoBase的常量。 -- perf(web):操作日志优化。 +- perf:TsTokenConfig不在提供静态方法 +- perf:移除TsTokenAspect,由TokenWebMvcConfigurer替代,并实现TokenBean参数注入 -## 1.0.12 -- perf(encrypt):开启关闭加解密移动到**yaml**中配置,移除**EnableEncryptConfig**注解。 -- feat(login):登录接口增加验签步骤,可通过**validLoginSign**属性开启或关闭(默认)。 -- perf(login):可重写**onSignError**方法自定义验签错误的跳转。 -- fix(login):修复微信、钉钉授权跳转地址错误的bug - -## 1.0.7 - -- feat(web): 增加uploadFileCustomize方法,允许自定义文件存放情况 -- feat(database): 增加db/data目录,存放初始化数据的sql -- perf(login): 增加默认值,防止token解析异常 - -## 1.0.6 - -- feat(web):新增 **OperationIgnore** 注解,可以指定接口忽略操作日志的收集。 -- feat(web):**OperationLog** 增加 desensitize 属性,用来脱敏指定的字段。 - -## 1.0.2 - -- feat(database):增加数据库定时备份; -- feat(database):增加过期备份的删除操作,默认过期时间为7天; -- perf(message):调整阿里云短信类,方便扩展其他方法。 -- perf(message):消息发送接口该body类型为 **JSONObject** -- perf(message):调整消息发送接口和方法(不兼容旧版本) - -## 1.0.1 - -- perf(web):fastjson增加配置 **DisableCircularReferenceDetect**,禁用相同的对象写成引用的形式。 - -## 1.0.0 - -- perf:hutool依赖升级:5.8.11 -> 5.8.16 -- perf:fastjson依赖升级:1.2.78 -> 1.2.83 -- perf:mybatis-plus依赖升级:3.5.1 -> 3.5.3 -- perf:**TieshengWebConfigurer** 增加 **configSystemCheck** 方法,可根据情况校验系统配置参数。 - -从该版本开始,仓库地址改为: - -``` pom - - - kepai-repo - http://git.kepai365.com/tiesheng/repository/raw/master - - -``` - -## 0.9.3 - -> 1,增加版本对比器,防止某些情况下版本对比失效; -> - -## 0.8.3 - -### 调整 - -> 1,优化返回数据加密; -> 2,上传文件接口调整,统一为**application/json**格式; - -## 0.8.0 - -### 调整 - -> 1,移除**PasswordUtil**类,新增**EncryptConfig**配置; -> 2,默认启用网络请求的加解密,前端请配合接口使用。 - -## 0.7.4 - -### 新增 - -> 现在操作日志默认收集(不包括GET请求):使用方法名称和接口作为参数存储。如果存在OperationLog注解,则使用注解的内容。 - -## 0.7.3 - -### 增加 - -> 1,TsTokenConfig增加新的属性**ignorePaths**,用于通过路径忽略token; -> 2,PasswordUtils增加密码复杂度校验方法; -> 3,PasswordUtils.verifyPassword增加登录次数限制:10分钟内不能错误6次; -> - -### 调整 - -> 1,TsTokenConfig中的**ignores**属性调整为**testMap**; diff --git a/CHANGELOG_V1.md b/CHANGELOG_V1.md new file mode 100644 index 0000000..ac226cb --- /dev/null +++ b/CHANGELOG_V1.md @@ -0,0 +1,94 @@ +## 1.1.0 + +- feat:globalConfig增加ext属性。 +- feat:增加网络请求超时、重定向的配置。 +- perf:更新数据库对比插件。 +- feat(web):增加DaoBase的常量。 +- perf(web):操作日志优化。 + + +## 1.0.12 + +- perf(encrypt):开启关闭加解密移动到**yaml**中配置,移除**EnableEncryptConfig**注解。 +- feat(login):登录接口增加验签步骤,可通过**validLoginSign**属性开启或关闭(默认)。 +- perf(login):可重写**onSignError**方法自定义验签错误的跳转。 +- fix(login):修复微信、钉钉授权跳转地址错误的bug + +## 1.0.7 + +- feat(web): 增加uploadFileCustomize方法,允许自定义文件存放情况 +- feat(database): 增加db/data目录,存放初始化数据的sql +- perf(login): 增加默认值,防止token解析异常 + +## 1.0.6 + +- feat(web):新增 **OperationIgnore** 注解,可以指定接口忽略操作日志的收集。 +- feat(web):**OperationLog** 增加 desensitize 属性,用来脱敏指定的字段。 + +## 1.0.2 + +- feat(database):增加数据库定时备份; +- feat(database):增加过期备份的删除操作,默认过期时间为7天; +- perf(message):调整阿里云短信类,方便扩展其他方法。 +- perf(message):消息发送接口该body类型为 **JSONObject** +- perf(message):调整消息发送接口和方法(不兼容旧版本) + +## 1.0.1 + +- perf(web):fastjson增加配置 **DisableCircularReferenceDetect**,禁用相同的对象写成引用的形式。 + +## 1.0.0 + +- perf:hutool依赖升级:5.8.11 -> 5.8.16 +- perf:fastjson依赖升级:1.2.78 -> 1.2.83 +- perf:mybatis-plus依赖升级:3.5.1 -> 3.5.3 +- perf:**TieshengWebConfigurer** 增加 **configSystemCheck** 方法,可根据情况校验系统配置参数。 + +从该版本开始,仓库地址改为: + +``` pom + + + kepai-repo + http://git.kepai365.com/tiesheng/repository/raw/master + + +``` + +## 0.9.3 + +> 1,增加版本对比器,防止某些情况下版本对比失效; +> + +## 0.8.3 + +### 调整 + +> 1,优化返回数据加密; +> 2,上传文件接口调整,统一为**application/json**格式; + +## 0.8.0 + +### 调整 + +> 1,移除**PasswordUtil**类,新增**EncryptConfig**配置; +> 2,默认启用网络请求的加解密,前端请配合接口使用。 + +## 0.7.4 + +### 新增 + +> 现在操作日志默认收集(不包括GET请求):使用方法名称和接口作为参数存储。如果存在OperationLog注解,则使用注解的内容。 + +## 0.7.3 + +### 增加 + +> 1,TsTokenConfig增加新的属性**ignorePaths**,用于通过路径忽略token; +> 2,PasswordUtils增加密码复杂度校验方法; +> 3,PasswordUtils.verifyPassword增加登录次数限制:10分钟内不能错误6次; +> + +### 调整 + +> 1,TsTokenConfig中的**ignores**属性调整为**testMap**; diff --git a/pom.xml b/pom.xml index 9f34838..fe40445 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.tiesheng.springboot-parent springboot-parent - 2.0.0.rc3 + 2.0.0.rc4 pom springboot-parent 杭州铁晟科技有限公司基础依赖 @@ -58,61 +58,61 @@ com.tiesheng.springboot-parent springboot-database - 2.0.0.rc3 + 2.0.0.rc4 com.tiesheng.springboot-parent springboot-login - 2.0.0.rc3 + 2.0.0.rc4 com.tiesheng.springboot-parent springboot-web - 2.0.0.rc3 + 2.0.0.rc4 com.tiesheng.springboot-parent springboot-util - 2.0.0.rc3 + 2.0.0.rc4 com.tiesheng.springboot-parent springboot-platform - 2.0.0.rc3 + 2.0.0.rc4 com.tiesheng.springboot-parent springboot-message - 2.0.0.rc3 + 2.0.0.rc4 com.tiesheng.springboot-parent springboot-encrypt - 2.0.0.rc3 + 2.0.0.rc4 com.tiesheng.springboot-parent springboot-role - 2.0.0.rc3 + 2.0.0.rc4 com.tiesheng.springboot-parent springboot-annotation - 2.0.0.rc3 + 2.0.0.rc4 com.tiesheng.springboot-parent springboot-poi - 2.0.0.rc3 + 2.0.0.rc4 diff --git a/springboot-ademo/.DS_Store b/springboot-ademo/.DS_Store index 8214f9ae3af7e61cc57657137bdc3da032ef9d5f..d7f77e0fb939a314bca9a0258af587d4e2f767e0 100644 GIT binary patch delta 338 zcmZoMXfc=|#>B!ku~2NHo}wrh0|Nsi1A_pAVQ_MOZUKlqGSgIJGb3`h;KBe1JMb;<>pQ#Su(5@XuT&cV+C3^8D+ Wd}p4_FXG4n3@|2;lFbn!YnTE1%12ZH delta 89 zcmZoMXfc=|#>B)qu~2NHo}wrd0|Nsi1A_nqLn=c_Qh9MfQcix-#=_-{lMO^zCfBok q-u#P|muX|e52nrR9Q+(Wjhh8IzB5ne7jfhOY6a com.tiesheng.springboot-parent springboot-parent - 2.0.0.rc3 + 2.0.0.rc4 springboot-ademo - 2.0.0.rc3 + 2.0.0.rc4 8 diff --git a/springboot-ademo/src/main/java/com/tiesheng/.DS_Store b/springboot-ademo/src/main/java/com/tiesheng/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..ba288633c2da79eaebc93c6a3d2e7115304f4a04 GIT binary patch literal 6148 zcmeH~JqiLr422WjLa^D=avBfd4F=H@>;)`VZ2SR1>p8kFnIJe?i^vNkZ<3j?>{sk; zL`2uOaV64=$P8{OOAC!D@=iwC%SkTx;d(w^&Ii=2K8drohWFC!$2NroNPq-LfCNb3 zhX~lc4V%rYGLirZkie6GeIF9sG>4X|{^>yQ5dhku?1r_^63}D?Xbvq^QGsbp4;roN zV~Ewg9h%}?4lPw{yJ!p_8c$Z6VqjX^MH3R3W)}t$Ac2O!wC26t|6BN{`M+slN&+PC zX9Tp{44XAxD(=>|*R%RAsPdeu*?-IE)c5W1hYm$ZBbcFC)Eg8=X9Kb?-)^nm65lztqSq2pmb=7oa&L==FYYddA!|$Gk%0j6&xm9{%g`r>w<-!?VPvP(o+s^OB3zyxoekkt5QPF#6z!?}baIDjr z-2XTD%T$Z}afr{H0cYTkF~F0iZ5DVayIa3Jp4_zo?G8;u{IU!n7>_;zFp+cQvKZAK aWDLJ(m=$Fe(U)+be+U#pymJPAfPps%TsQLo literal 0 HcmV?d00001 diff --git a/springboot-annotation/.DS_Store b/springboot-annotation/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..48a4f5879a8d8c080ceb10fbf71c753e907980b2 GIT binary patch literal 6148 zcmeHKOHRWu5S^g~DzT}AkXZT(y@83s33>r&i^`%=DronpUrThKRV?uVzG3BAQ?bvMeeh>Z<9;oW;nJV>Vy*-L{hA_o`&?BYLCOPfy$X;BW0cXG&a0dP#1GuwACTEI1I|I&uGw{xUoDTs*Fd8Psd~{&SEdX!~ zbr!6pmynoX7!8vmED+XEpoX%w7_8yY2lI=DNm0Xzt@&W9{MNj1u8#a6yAwx6pPd0` zpk!dAk5jq-ukp!LoBT4wpPT__;EyrD<96OQcqzMEzr3E@wE^P>Lqz com.tiesheng.springboot-parent springboot-parent - 2.0.0.rc3 + 2.0.0.rc4 springboot-annotation diff --git a/springboot-database/.DS_Store b/springboot-database/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..19a2764e65961d57e374a84b43d4102b252b2bad GIT binary patch literal 6148 zcmeHKOHRWu5S^hFs>G%nB$hq_Qg2|QbjyNX0Ggt*Xp{=ty^q8ZSaAb54{tmJ#3f>h z5X?ySbLQ(jDRzd4xZ1B~L{lP~Uvzx=ecU0p9X-4Yu3r|RYO`J!)KePi9;^|K~~(J}4l1{K$IOS`h_RdZ-RsQvV+ zwTm2WSL|TWr`*S*?8C(wa0Z+KXW)M_fIC}ca-!(7GvEw310M{?`4BJ!qhV6aM+c_d z0szNQXTe%}35f}Y(J(2(0$~jWYA9Qa!5R*IFu!P+6g8aKnh&c}6mJ8@L> z*%@#KN(M&yIF com.tiesheng.springboot-parent springboot-parent - 2.0.0.rc3 + 2.0.0.rc4 springboot-database diff --git a/springboot-encrypt/.DS_Store b/springboot-encrypt/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..531790e84fc1e0f10e312284ff9d50543af1d5f8 GIT binary patch literal 6148 zcmeHKOHRWu5FOJBRbtZxNQjkpZ0QX`6!u8H0JKGA(I^#^y^qF<8^C#Z&ohX)L@W`4 z8OeF}e4Qu7&WK2;pH?%GsfbK4h=G#=d;gcC`^2-okIRnnXA7dbln|V{?rR;9~@_M{$BgPE|g?@<>2 com.tiesheng.springboot-parent springboot-parent - 2.0.0.rc3 + 2.0.0.rc4 springboot-encrypt diff --git a/springboot-login/.DS_Store b/springboot-login/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..2c0d7ddf1973edac51984d4df1a39b728d262891 GIT binary patch literal 6148 zcmeHKOHKnZ47F)NmDqHHV3{lQ24OUupc|IZ78Rk6rh>B15jX-zVZ{yLJUquPOv;EQ zLdBMnm-rKBo-|2JL|i>CCPZT*8lefY40=S=y`}?m79-0Vlj*!|)>*r?naiIA+53PV z=$_`QWq1FFmtU5qt?SvUok0WtRK1MR&bEg><%Fd8OBSRkySKn-OpF<8T)59SvQlcI(bTYrj+|wq+JlVY7Y&o5tRngx4)ljWCd4~u;1?M907V8uV*mgE literal 0 HcmV?d00001 diff --git a/springboot-login/pom.xml b/springboot-login/pom.xml index 0f8653f..f32ed4f 100644 --- a/springboot-login/pom.xml +++ b/springboot-login/pom.xml @@ -6,7 +6,7 @@ com.tiesheng.springboot-parent springboot-parent - 2.0.0.rc3 + 2.0.0.rc4 springboot-login diff --git a/springboot-login/src/main/java/com/tiesheng/login/config/TokenWebMvcConfigurer.java b/springboot-login/src/main/java/com/tiesheng/login/config/TokenWebMvcConfigurer.java new file mode 100644 index 0000000..237ef6e --- /dev/null +++ b/springboot-login/src/main/java/com/tiesheng/login/config/TokenWebMvcConfigurer.java @@ -0,0 +1,92 @@ +package com.tiesheng.login.config; + +import cn.hutool.core.util.ObjUtil; +import cn.hutool.core.util.StrUtil; +import com.tiesheng.annotation.token.TokenIgnore; +import com.tiesheng.util.config.TsTokenConfig; +import com.tiesheng.util.pojos.TokenBean; +import org.springframework.context.annotation.Configuration; +import org.springframework.core.MethodParameter; +import org.springframework.web.bind.support.WebDataBinderFactory; +import org.springframework.web.context.request.NativeWebRequest; +import org.springframework.web.method.HandlerMethod; +import org.springframework.web.method.support.HandlerMethodArgumentResolver; +import org.springframework.web.method.support.ModelAndViewContainer; +import org.springframework.web.servlet.HandlerInterceptor; +import org.springframework.web.servlet.config.annotation.InterceptorRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.List; + + +@Configuration +public class TokenWebMvcConfigurer implements WebMvcConfigurer { + + @Resource + TsTokenConfig tsTokenConfig; + + @Override + public void addArgumentResolvers(List resolvers) { + resolvers.add(new HandlerMethodArgumentResolver() { + @Override + public boolean supportsParameter(MethodParameter parameter) { + return parameter.getParameterType().isAssignableFrom(TokenBean.class); + } + + @Override + public Object resolveArgument(MethodParameter parameter, ModelAndViewContainer mavContainer, + NativeWebRequest webRequest, WebDataBinderFactory binderFactory) { + String header = webRequest.getHeader(TsTokenConfig.TOKEN_KEY); + return tsTokenConfig.validToken(header, true); + } + }); + } + + + @Override + public void addInterceptors(InterceptorRegistry registry) { + registry.addInterceptor(new HandlerInterceptor() { + @Override + public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) { + + String requestURI = request.getRequestURI(); + String[] ignorePaths = tsTokenConfig.getIgnorePaths(); + if (ObjUtil.isNotEmpty(ignorePaths)) { + for (String path : ignorePaths) { + if (path.contains("/**") && + StrUtil.startWith(requestURI, path.replace("/**", ""))) { + // 通配路径 + return true; + } else if (requestURI.equals(path)) { + // 完整路径 + return true; + } + } + } + + // 过滤不要需要验证的接口(注解) + HandlerMethod handlerMethod = (HandlerMethod) handler; + TokenIgnore annotation = handlerMethod.getBeanType().getAnnotation(TokenIgnore.class); + if (annotation != null) { + return true; + } + TokenIgnore apiTokenIgnore = handlerMethod.getMethodAnnotation(TokenIgnore.class); + if (apiTokenIgnore != null) { + return true; + } + + // token验证 + tsTokenConfig.validToken(request, true); + + return true; + } + }); + } +} + + + + diff --git a/springboot-login/src/main/java/com/tiesheng/login/config/TsTokenAspect.java b/springboot-login/src/main/java/com/tiesheng/login/config/TsTokenAspect.java deleted file mode 100644 index b892d11..0000000 --- a/springboot-login/src/main/java/com/tiesheng/login/config/TsTokenAspect.java +++ /dev/null @@ -1,88 +0,0 @@ -package com.tiesheng.login.config; - -import cn.hutool.core.util.ObjUtil; -import cn.hutool.core.util.StrUtil; -import com.tiesheng.annotation.token.TokenIgnore; -import com.tiesheng.util.ServletKit; -import com.tiesheng.util.config.TsTokenConfig; -import org.aspectj.lang.JoinPoint; -import org.aspectj.lang.annotation.Aspect; -import org.aspectj.lang.annotation.Before; -import org.aspectj.lang.annotation.Pointcut; -import org.aspectj.lang.reflect.MethodSignature; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -import java.lang.reflect.Method; - - -/** - * @author hao - * @ProjectName CmccSpring - * @Copyright Hangzhou ShuoChuang Technology Co.,Ltd All Right Reserved - * @Description 这里是对文件的描述 - * @data 2019-07-15 - * @note 这里写文件的详细功能和改动 - * @note - */ -@Aspect -@Component -public class TsTokenAspect { - - @Autowired - TsTokenConfig tsTokenConfig; - - - /** - * 切入点 - */ - @Pointcut("execution(* com..controller..*.*(..))") - public void methodArgs() { - - } - - - /** - * 获取操作日志说明 - * - * @param joinPoint - */ - @Before("methodArgs()") - public void before(JoinPoint joinPoint) { - - // 过滤不要需要验证的接口(path) - String requestURI = ServletKit.getRequest().getRequestURI(); - String[] ignorePaths = tsTokenConfig.getIgnorePaths(); - if (ObjUtil.isNotEmpty(ignorePaths)) { - for (String path : ignorePaths) { - if (path.contains("/**") && - StrUtil.startWith(requestURI, path.replace("/**", ""))) { - // 通配路径 - return; - } else if (requestURI.equals(path)) { - // 完整路径 - return; - } - } - } - - // 过滤不要需要验证的接口(注解) - Object aThis = joinPoint.getTarget(); - TokenIgnore annotation = aThis.getClass().getAnnotation(TokenIgnore.class); - if (annotation != null) { - return; - } - MethodSignature signature = (MethodSignature) joinPoint.getSignature(); - Method method = signature.getMethod(); - TokenIgnore apiTokenIgnore = method.getAnnotation(TokenIgnore.class); - if (apiTokenIgnore != null) { - return; - } - - // token验证 - tsTokenConfig.validToken(true); - - } - - -} diff --git a/springboot-message/.DS_Store b/springboot-message/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..77447b56e56d265b0a6b5a61809b0b813791883d GIT binary patch literal 6148 zcmeHKJ5B>J5S<|ribRtJiPAk)8fvpzPLK;g5)_K8HiFRm0^A{|$ql#)HE%ovtihs0 z2xcVvdFShW(%L&j#LeSsMl>a&35Focq9UTMnvTp_j4U~3^JU*{D=B`jO7=dY2fC-_ zW6ArK3tpuXTTY72L2}lxU)qjCyG8h1I~am@Xmmo4*^3k8YabjbYRLY z0B{U-7ObV0keFZ?4U-})5Y|wjhO)I7tl`iH^NWT_QNxL?`CzO3*1T}8j{G6J6Gug# zodIW{WMHI^Q@Q`I@X1u0{4&I!oB?Oxk1@dGcHTC4DZ5+0yq?^(0pl7&MEsI0AXpba j0eFyeFnAwD?+Kfu5%0JuUh literal 0 HcmV?d00001 diff --git a/springboot-message/pom.xml b/springboot-message/pom.xml index 9559299..55839dd 100644 --- a/springboot-message/pom.xml +++ b/springboot-message/pom.xml @@ -6,7 +6,7 @@ com.tiesheng.springboot-parent springboot-parent - 2.0.0.rc3 + 2.0.0.rc4 springboot-message diff --git a/springboot-platform/.DS_Store b/springboot-platform/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..bb85cfdd53a936d456bf0ba173cd3723c03e5a25 GIT binary patch literal 6148 zcmeHK%S{6@5S<|rio_)sB#!O?r315CDo6v61cgIZ8-;Lp36w$=bdVBgfirJB1FXT~ zh!D(3_Vdoy`=qsZh=`l})r@FLL=y}_mPJKGT{Rt9M0d2K zvvFR7kz&|yI)2EA}b@h#PdppR=0bz7Zd%8x&HQms@ta^CBC5R8UNF&`b6 zati<)L!AX{=_Mp47)HaS2n&QY6sVzWEe2~i^uhe1VN%p^VrxFwD!(-^oU0>$$nL~Z z(PwAC87LVT>El%H|4V!_)h53T@h4}%8Texi@VK3~4PMIb)-SIocWuD9!VnR^Bnt@E l#ZLep com.tiesheng.springboot-parent springboot-parent - 2.0.0.rc3 + 2.0.0.rc4 springboot-platform diff --git a/springboot-poi/.DS_Store b/springboot-poi/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..3758dd959a0482a0893fcb15f5e4f66cfb5034d4 GIT binary patch literal 6148 zcmeHKOHRWu5S^hFio~W8LSpGFbkD*>;RL+^v_)mnC{-zYUxe#$1FpiFH=Y4vuvj7l zGm`zB`8rREogpG_AJ%iC84)!Yf-H-Qh`MSzGG{TeF? zj(!;Lpzc%IhwR108E^)i0cYUL17$V}AWC6jt_zA#+ hoFnJisP-Uh_(j8{C|N|G!-4)IkO}e08TbJPUI87LK`8(L literal 0 HcmV?d00001 diff --git a/springboot-poi/pom.xml b/springboot-poi/pom.xml index 88c477c..ca46c32 100644 --- a/springboot-poi/pom.xml +++ b/springboot-poi/pom.xml @@ -6,7 +6,7 @@ com.tiesheng.springboot-parent springboot-parent - 2.0.0.rc3 + 2.0.0.rc4 springboot-poi diff --git a/springboot-role/.DS_Store b/springboot-role/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..c964671ca69d915a5ab227f213968f85cd7840a0 GIT binary patch literal 6148 zcmeHKJ5B>J5S<|ribRtJiPBfd4a{meK`sDEP$;t62tw~ea3%_RT3T8fdfs>jSO<#| zA()Zu=bf+jNo(&A5jVH18PSx8CK!S&i;9T4YC14yF|y>C&6j<*t)%$9D%typZs?kp zoAq%24|kuIu5a7Lre8n<|I|Dl-=7Yxt8c8^t3g(NK^PsrcQg!tqP`~U-QLJUQ? literal 0 HcmV?d00001 diff --git a/springboot-role/pom.xml b/springboot-role/pom.xml index 38515d6..497ddd9 100644 --- a/springboot-role/pom.xml +++ b/springboot-role/pom.xml @@ -6,7 +6,7 @@ com.tiesheng.springboot-parent springboot-parent - 2.0.0.rc3 + 2.0.0.rc4 springboot-role diff --git a/springboot-role/src/main/java/com/tiesheng/role/controller/RoleController.java b/springboot-role/src/main/java/com/tiesheng/role/controller/RoleController.java index 7d1e916..c52cd88 100644 --- a/springboot-role/src/main/java/com/tiesheng/role/controller/RoleController.java +++ b/springboot-role/src/main/java/com/tiesheng/role/controller/RoleController.java @@ -1,5 +1,6 @@ package com.tiesheng.role.controller; +import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; @@ -12,7 +13,6 @@ import com.tiesheng.role.pojos.vo.GroupTypeDTO; import com.tiesheng.role.pojos.vo.RoleUserPageVO; import com.tiesheng.role.pojos.vo.ServiceMenuVO; import com.tiesheng.role.service.CoreRoleService; -import com.tiesheng.util.config.TsTokenConfig; import com.tiesheng.util.exception.ApiException; import com.tiesheng.util.pojos.ApiResp; import com.tiesheng.util.pojos.IdDTO; @@ -22,6 +22,7 @@ import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import javax.validation.Valid; +import java.util.ArrayList; import java.util.List; import java.util.Objects; import java.util.stream.Collectors; @@ -249,15 +250,18 @@ public class RoleController { * @return */ @GetMapping("/owner/server") - public ApiResp> ownerServer() { - TokenBean tokenBean = TsTokenConfig.get(); + public ApiResp> ownerServer(TokenBean tokenBean) { List allOwnerMenus = coreRoleService.getOwnerAuthorityLeafList(tokenBean.getId(), tokenBean.getRoleId()); - - List roleServerList = coreRoleService.getServerMapper().selectList(new QueryWrapper() - .in("id", allOwnerMenus.stream().map(CoreRoleAuthority::getService).collect(Collectors.toList())) - .eq(CoreRoleServer.IS_DELETED, 0) - .eq("is_open", 1) - ); + List list = allOwnerMenus.stream().map(CoreRoleAuthority::getService).collect(Collectors.toList()); + + List roleServerList = new ArrayList<>(); + if (CollUtil.isNotEmpty(list)) { + roleServerList = coreRoleService.getServerMapper().selectList(new QueryWrapper() + .in("id", list) + .eq(CoreRoleServer.IS_DELETED, 0) + .eq("is_open", 1) + ); + } return ApiResp.respOK(roleServerList); } @@ -269,11 +273,8 @@ public class RoleController { * @return */ @GetMapping("/owner/menu") - public ApiResp> ownerMenu(@Valid OwnerMenuDTO dto) { - - TokenBean tokenBean = TsTokenConfig.get(); + public ApiResp> ownerMenu(TokenBean tokenBean, @Valid OwnerMenuDTO dto) { List ownerMenus = coreRoleService.getOwnerMenus(tokenBean.getId(), tokenBean.getRoleId(), dto); - return ApiResp.respOK(ownerMenus); } @@ -283,9 +284,8 @@ public class RoleController { * @return */ @GetMapping("/owner/point") - public ApiResp> ownerPoint(@Valid OwnerPointDTO dto) { + public ApiResp> ownerPoint(TokenBean tokenBean, @Valid OwnerPointDTO dto) { - TokenBean tokenBean = TsTokenConfig.get(); List allOwnerMenus = coreRoleService.getOwnerAuthorityLeafList(tokenBean.getId(), tokenBean.getRoleId()); String parentId; diff --git a/springboot-util/.DS_Store b/springboot-util/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..ebb34b99b64c6bc9e63a2d1083b58112fe3933b9 GIT binary patch literal 6148 zcmeHKJ5Iwu5S<|ribRtJiPBd{Phlc+f?NQSpisne6hiM~a2u!)B~{MDdpiSogGGrD z%t*U$J>T_{yz3DWo!&1eB4ZI5VGxyz9-+F|bmY!7DsxO`i>BW6r1-rm?tLJ4vX#Yp z)!qNg{?k%7RW)BXb7<)Qus?mi=vtTGSU0zwtonp7IhLJVqvA?#WS3P{IX|=?)PD5Z zS&q8NcF^mS@8gyG2nhy)fnXpQ_@4~m&Zdk`3}X%kf`MS*g8`lo1qQKnYz@=Vfhn~B zz#-I0ux2m8n8LAiYz<+7sD%P8RK3Me3x~dNztXWav~W>xKGZ9}H!qs1BY%1;!Nyg?=p;5UjJG j06g#0fs_lrVg literal 0 HcmV?d00001 diff --git a/springboot-util/pom.xml b/springboot-util/pom.xml index a8fbbba..bdbe004 100644 --- a/springboot-util/pom.xml +++ b/springboot-util/pom.xml @@ -6,7 +6,7 @@ com.tiesheng.springboot-parent springboot-parent - 2.0.0.rc3 + 2.0.0.rc4 springboot-util diff --git a/springboot-util/src/main/java/com/tiesheng/util/config/TsTokenConfig.java b/springboot-util/src/main/java/com/tiesheng/util/config/TsTokenConfig.java index 648f5b1..8d10d4a 100644 --- a/springboot-util/src/main/java/com/tiesheng/util/config/TsTokenConfig.java +++ b/springboot-util/src/main/java/com/tiesheng/util/config/TsTokenConfig.java @@ -4,15 +4,15 @@ package com.tiesheng.util.config; import cn.hutool.core.map.MapUtil; import cn.hutool.core.util.StrUtil; import cn.hutool.extra.servlet.ServletUtil; -import cn.hutool.extra.spring.SpringUtil; +import cn.hutool.json.JSONUtil; import cn.hutool.jwt.JWT; import cn.hutool.jwt.JWTValidator; -import com.tiesheng.util.ServletKit; import com.tiesheng.util.exception.ApiException; import com.tiesheng.util.pojos.TokenBean; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.context.annotation.Configuration; +import javax.servlet.http.HttpServletRequest; import java.util.Map; @@ -23,6 +23,11 @@ import java.util.Map; @ConfigurationProperties("tiesheng.token") public class TsTokenConfig { + /** + * token常量 + */ + public static final String TOKEN_KEY = "token"; + private Map testMap = MapUtil.newHashMap(); private String encryptKey = "%kIp9frQCu"; private Integer expireHours = 48; @@ -30,28 +35,6 @@ public class TsTokenConfig { private boolean validLoginSign = false; - /** - * 获取当前登录的token - * - * @return - */ - public static TokenBean get() { - TsTokenConfig tokenConfig = SpringUtil.getBean(TsTokenConfig.class); - return tokenConfig.validToken(true); - } - - - /** - * 获取当前登录的token - * - * @return - */ - public static TokenBean getWithoutThr() { - TsTokenConfig tokenConfig = SpringUtil.getBean(TsTokenConfig.class); - return tokenConfig.validToken(false); - } - - /** * 验证token * @@ -72,8 +55,8 @@ public class TsTokenConfig { * @param thrExp * @return */ - public TokenBean validToken(boolean thrExp) { - String token = ServletUtil.getHeader(ServletKit.getRequest(), "token", "utf-8"); + public TokenBean validToken(HttpServletRequest request, boolean thrExp) { + String token = ServletUtil.getHeader(request, TOKEN_KEY, "utf-8"); return validToken(token, thrExp); } @@ -92,14 +75,7 @@ public class TsTokenConfig { try { JWT decode = JWT.of(token); JWTValidator.of(decode).validateDate(); - String id = decode.getPayload("id").toString(); - String environmentType = decode.getPayload("environmentType").toString(); - String service = decode.getPayload("service").toString(); - String extra = StrUtil.toStringOrNull(decode.getPayload("extra")); - String roleId = StrUtil.toStringOrNull(decode.getPayload("roleId")); - tokenBean = new TokenBean(id, environmentType, service); - tokenBean.setRoleId(roleId); - tokenBean.setExtra(extra); + tokenBean = JSONUtil.toBean(decode.getPayloads(), TokenBean.class); } catch (Exception ignored) { } diff --git a/springboot-web/.DS_Store b/springboot-web/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..f463405bd21a9743b996f7bd89d629f5ad95883c GIT binary patch literal 6148 zcmeHKK~4iP476#5DskxriDSOdAB5HR1^ocDMdi@dR;5TB^Ob&s6DQ7G;603EBQ|B# zBNEh>vXjJi?2NQYOhjBgE+<4|A{wCyvUGYxrh8RqW-LmUH72t~+idbI#(zR2_W?c7 zmKN((H~**ox29?9dcJPwn1Ow&-Y;LTyV~Uu?dHC->JVN;=d`0+L|oAw?aHWc&xiVh z*e@R%yI7-Xiwt^g$~>av;o=N91I~amaGDI*9X+}@&F%ZHodIXy2m^9H1T?{Dm=yET zfln?0fcmgiozxQI6AYtaQiKM=>Izg>wi1JLDI)q{cF`~?syne2A8e7oiWkn&;UBU& zaa8oLGvExA3=DKQmivE-U#7RnFI{}(3^)V-i~%0jv%12j>~8(BJ-KTG+6|hB*d^&e m&@UbV7|1ztm6fUw(uZ9%Op3CK%x8C?KLj!%{&5C=fq_qJlS4TG literal 0 HcmV?d00001 diff --git a/springboot-web/pom.xml b/springboot-web/pom.xml index 49a4d47..3d845f2 100644 --- a/springboot-web/pom.xml +++ b/springboot-web/pom.xml @@ -6,7 +6,7 @@ com.tiesheng.springboot-parent springboot-parent - 2.0.0.rc3 + 2.0.0.rc4 springboot-web diff --git a/springboot-web/src/main/java/com/tiesheng/web/config/operation/OperationAspect.java b/springboot-web/src/main/java/com/tiesheng/web/config/operation/OperationAspect.java index fdaec94..1277a37 100644 --- a/springboot-web/src/main/java/com/tiesheng/web/config/operation/OperationAspect.java +++ b/springboot-web/src/main/java/com/tiesheng/web/config/operation/OperationAspect.java @@ -38,6 +38,8 @@ public class OperationAspect { @Autowired CoreLogService coreLogService; + @Autowired + TsTokenConfig tsTokenConfig; @Pointcut("execution(* com..controller..*.*(..))") @@ -109,7 +111,8 @@ public class OperationAspect { } } - coreLogService.addOperationLog(TsTokenConfig.getWithoutThr(), title, subject, reqMaps); + coreLogService.addOperationLog( + tsTokenConfig.validToken(request, false), title, subject, reqMaps); return response; }