From 6fbcab93514d151ecf945d680d415d3425671d72 Mon Sep 17 00:00:00 2001 From: xupei Date: Tue, 9 Jan 2024 13:54:32 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=87=AA=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E6=97=A5=E5=BF=97=E7=AE=A1=E7=90=86=EF=BC=8C=E8=BE=93=E5=87=BA?= =?UTF-8?q?=E5=88=B0=E6=97=A5=E5=BF=97=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 6 ++ .../security/filter/AuthenticationFilter.java | 12 +-- src/main/resources/logback-spring.xml | 84 +++++++++++++++++++ 3 files changed, 96 insertions(+), 6 deletions(-) create mode 100644 src/main/resources/logback-spring.xml diff --git a/pom.xml b/pom.xml index f699d574..50c4b965 100644 --- a/pom.xml +++ b/pom.xml @@ -76,6 +76,12 @@ org.springframework.boot spring-boot-starter-validation + + + org.springframework.boot + spring-boot-starter-logging + + cn.hutool hutool-all diff --git a/src/main/java/com/ai/da/common/security/filter/AuthenticationFilter.java b/src/main/java/com/ai/da/common/security/filter/AuthenticationFilter.java index 39b52960..4b78233d 100644 --- a/src/main/java/com/ai/da/common/security/filter/AuthenticationFilter.java +++ b/src/main/java/com/ai/da/common/security/filter/AuthenticationFilter.java @@ -110,12 +110,12 @@ public class AuthenticationFilter extends OncePerRequestFilter { //校验token String cacheToken = LocalCacheUtils.getTokenCache(String.valueOf(principal.getId())); -// if(StringUtils.isEmpty(cacheToken)){ -// throw new RuntimeException("TOKEN已过期,请重新登录!"); -// } -// if(!cacheToken.equals(jwtToken) ){ -// throw new RuntimeException("TOKEN已过期,请重新登录!"); -// } + if(StringUtils.isEmpty(cacheToken)){ + throw new RuntimeException("TOKEN已过期,请重新登录!"); + } + if(!cacheToken.equals(jwtToken) ){ + throw new RuntimeException("TOKEN已过期,请重新登录!"); + } // UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken(null, null); // SecurityContextHolder.getContext().setAuthentication(authentication); } diff --git a/src/main/resources/logback-spring.xml b/src/main/resources/logback-spring.xml new file mode 100644 index 00000000..e80db240 --- /dev/null +++ b/src/main/resources/logback-spring.xml @@ -0,0 +1,84 @@ + + + + + + + + + + + + + + + + ${log.pattern.console} + + + + + + + ${log.path}/aida-info.log + + + + ${log.path}/aida-info.%d{yyyy-MM-dd}.log + + 60 + + + + ${log.pattern.file} + + + + + + + ACCEPT + + DENY + + + + + ${log.path}/aida-error.log + + + + ${log.path}/aida-error.%d{yyyy-MM-dd}.log + + 60 + + + ${log.pattern.file} + + + + ERROR + + ACCEPT + + DENY + + + + + + + + + + + + + + + + + + + \ No newline at end of file