From a819f18c96a9e85b88f9040aff8694cea1e00221 Mon Sep 17 00:00:00 2001 From: k3ppf0r <2094289254@qq.com> Date: Wed, 4 Jun 2025 09:56:29 +0800 Subject: [PATCH] =?UTF-8?q?refactor(application):=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=BA=93=E5=AF=86=E7=A0=81=E5=92=8C=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E6=97=A5=E5=BF=97=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将数据库密码从 'woshishujukumima' 修改为 'root' - 添加服务器端口配置- 更新 Shiro 类中的日志记录方式,使用 LoggerFactory 创建 logger- 修正 Shiro 类中的导入语句 --- src/main/java/org/joychou/controller/Shiro.java | 7 +++++-- src/main/resources/application.properties | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/joychou/controller/Shiro.java b/src/main/java/org/joychou/controller/Shiro.java index 2dc143ca..bb0adfa6 100644 --- a/src/main/java/org/joychou/controller/Shiro.java +++ b/src/main/java/org/joychou/controller/Shiro.java @@ -5,18 +5,21 @@ import org.apache.shiro.crypto.AesCipherService; import org.joychou.config.Constants; import org.joychou.util.CookieUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; import javax.servlet.http.Cookie; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.*; + import static org.springframework.web.util.WebUtils.getCookie; @Slf4j @RestController public class Shiro { - + private static final Logger logger = LoggerFactory.getLogger(SSRF.class); byte[] KEYS = java.util.Base64.getDecoder().decode("kPH+bIxk5D2deZiIxcaaaA=="); private final static String DELETE_ME = "deleteMe"; AesCipherService acs = new AesCipherService(); @@ -39,7 +42,7 @@ public String shiro_deserialize(HttpServletRequest req, HttpServletResponse res) in.close(); } catch (Exception e){ if (CookieUtils.addCookie(res, "rememberMe", DELETE_ME)){ - log.error(e.getMessage()); + logger.error(e.getMessage()); return "RememberMe cookie decrypt error. Set deleteMe cookie success."; } } diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 326a2b76..1c436c20 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1,7 +1,7 @@ - +server.port=18989 spring.datasource.url=jdbc:mysql://localhost:3306/java_sec_code?allowPublicKeyRetrieval=true&useSSL=false&serverTimezone=UTC spring.datasource.username=root -spring.datasource.password=woshishujukumima +spring.datasource.password=root spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver mybatis.mapper-locations=classpath:mapper/*.xml # mybatis SQL log