防登录信息过长攻击
This commit is contained in:
@@ -107,6 +107,9 @@ public class FormFilter extends org.apache.shiro.web.filter.authc.FormAuthentica
|
|||||||
if (StringUtils.isBlank(username)){
|
if (StringUtils.isBlank(username)){
|
||||||
username = ObjectUtils.toString(request.getAttribute(getUsernameParam()), StringUtils.EMPTY);
|
username = ObjectUtils.toString(request.getAttribute(getUsernameParam()), StringUtils.EMPTY);
|
||||||
}
|
}
|
||||||
|
if (StringUtils.length(username) > 1000) {
|
||||||
|
throw new AuthenticationException("msg:"+Global.getText("sys.login.error"));
|
||||||
|
}
|
||||||
// 登录用户名解密(解决登录用户名明文传输安全问题)
|
// 登录用户名解密(解决登录用户名明文传输安全问题)
|
||||||
String secretKey = Global.getProperty("shiro.loginSubmit.secretKey");
|
String secretKey = Global.getProperty("shiro.loginSubmit.secretKey");
|
||||||
if (StringUtils.isNotBlank(username) && StringUtils.isNotBlank(secretKey)){
|
if (StringUtils.isNotBlank(username) && StringUtils.isNotBlank(secretKey)){
|
||||||
@@ -134,6 +137,9 @@ public class FormFilter extends org.apache.shiro.web.filter.authc.FormAuthentica
|
|||||||
if (StringUtils.isBlank(password)){
|
if (StringUtils.isBlank(password)){
|
||||||
password = ObjectUtils.toString(request.getAttribute(getPasswordParam()), StringUtils.EMPTY);
|
password = ObjectUtils.toString(request.getAttribute(getPasswordParam()), StringUtils.EMPTY);
|
||||||
}
|
}
|
||||||
|
if (StringUtils.length(password) > 1000) {
|
||||||
|
throw new AuthenticationException("msg:"+Global.getText("sys.login.error"));
|
||||||
|
}
|
||||||
// 登录密码解密(解决登录密码明文传输安全问题)
|
// 登录密码解密(解决登录密码明文传输安全问题)
|
||||||
String secretKey = Global.getProperty("shiro.loginSubmit.secretKey");
|
String secretKey = Global.getProperty("shiro.loginSubmit.secretKey");
|
||||||
if (StringUtils.isNotBlank(password) && StringUtils.isNotBlank(secretKey)){
|
if (StringUtils.isNotBlank(password) && StringUtils.isNotBlank(secretKey)){
|
||||||
@@ -173,6 +179,9 @@ public class FormFilter extends org.apache.shiro.web.filter.authc.FormAuthentica
|
|||||||
if (StringUtils.isBlank(captcha)){
|
if (StringUtils.isBlank(captcha)){
|
||||||
captcha = ObjectUtils.toString(request.getAttribute(CAPTCHA_PARAM), StringUtils.EMPTY);
|
captcha = ObjectUtils.toString(request.getAttribute(CAPTCHA_PARAM), StringUtils.EMPTY);
|
||||||
}
|
}
|
||||||
|
if (StringUtils.length(captcha) > 100) {
|
||||||
|
throw new AuthenticationException("msg:"+Global.getText("sys.login.error"));
|
||||||
|
}
|
||||||
// 登录用户名解密(解决登录用户名明文传输安全问题)
|
// 登录用户名解密(解决登录用户名明文传输安全问题)
|
||||||
String secretKey = Global.getProperty("shiro.loginSubmit.secretKey");
|
String secretKey = Global.getProperty("shiro.loginSubmit.secretKey");
|
||||||
if (StringUtils.isNotBlank(captcha) && StringUtils.isNotBlank(secretKey)){
|
if (StringUtils.isNotBlank(captcha) && StringUtils.isNotBlank(secretKey)){
|
||||||
|
|||||||
Reference in New Issue
Block a user