Commit 91986f13 by RuoYi

国家信息安全漏洞(请务必保持cipherKey密钥唯一性)

parent 7728ad9e
...@@ -108,6 +108,8 @@ shiro: ...@@ -108,6 +108,8 @@ shiro:
httpOnly: true httpOnly: true
# 设置Cookie的过期时间,天为单位 # 设置Cookie的过期时间,天为单位
maxAge: 30 maxAge: 30
# 设置密钥,务必保持唯一性(生成方式,直接拷贝到main运行即可)KeyGenerator keygen = KeyGenerator.getInstance("AES"); SecretKey deskey = keygen.generateKey(); System.out.println(Base64.encodeToString(deskey.getEncoded()));
cipherKey: zSyK5Kp6PZAAjlT+eeNMlg==
session: session:
# Session超时时间,-1代表永不过期(默认30分钟) # Session超时时间,-1代表永不过期(默认30分钟)
expireTime: 30 expireTime: 30
......
...@@ -85,6 +85,10 @@ public class ShiroConfig ...@@ -85,6 +85,10 @@ public class ShiroConfig
@Value("${shiro.cookie.maxAge}") @Value("${shiro.cookie.maxAge}")
private int maxAge; private int maxAge;
// 设置cipherKey密钥
@Value("${shiro.cookie.cipherKey}")
private String cipherKey;
// 登录地址 // 登录地址
@Value("${shiro.user.loginUrl}") @Value("${shiro.user.loginUrl}")
private String loginUrl; private String loginUrl;
...@@ -328,7 +332,7 @@ public class ShiroConfig ...@@ -328,7 +332,7 @@ public class ShiroConfig
{ {
CookieRememberMeManager cookieRememberMeManager = new CookieRememberMeManager(); CookieRememberMeManager cookieRememberMeManager = new CookieRememberMeManager();
cookieRememberMeManager.setCookie(rememberMeCookie()); cookieRememberMeManager.setCookie(rememberMeCookie());
cookieRememberMeManager.setCipherKey(Base64.decode("fCq+/xW488hMTCD+cmJ3aQ==")); cookieRememberMeManager.setCipherKey(Base64.decode(cipherKey));
return cookieRememberMeManager; return cookieRememberMeManager;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment