das项目结构修改

This commit is contained in:
chenhaojie 2024-06-21 13:41:03 +08:00
parent f8cbe540ca
commit 3e05a4d1bb
3 changed files with 17 additions and 11 deletions

View File

@ -34,15 +34,20 @@ public class DecryptingOncePerRequestFilter extends OncePerRequestFilter {
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain)
throws ServletException, IOException {
String iv = request.getHeader("v");
String contentType = request.getHeader("Content-Type");
String method = request.getMethod();
if ("POST".equals(method) && StringUtils.isNotBlank(contentType) && contentType.contains("application/json")) {
// 读取加密的请求体数据
String encryptedData = readRequestBody(request);
if (StringUtils.isNotBlank(encryptedData)) {
encryptedData = AESUtil.decrypt(aeskey, encryptedData, iv);
// 读取加密的请求体数据
String encryptedData = readRequestBody(request);
if (StringUtils.isNotBlank(encryptedData)) {
encryptedData = AESUtil.decrypt(aeskey, encryptedData, iv);
// 使用自定义的请求包装器替换原始请求
filterChain.doFilter(new DecryptingHttpServletRequestWrapper(request, encryptedData), response);
// 使用自定义的请求包装器替换原始请求
filterChain.doFilter(new DecryptingHttpServletRequestWrapper(request, encryptedData), response);
} else {
filterChain.doFilter(request, response);
}
} else {
filterChain.doFilter(request, response);
}

View File

@ -31,6 +31,7 @@ public class TokenOncePerRequestFilter extends OncePerRequestFilter {
@Override
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain)
throws ServletException, IOException {
String iv = request.getHeader("v");
// token解密
String token = request.getHeader("token");

View File

@ -67,10 +67,10 @@ public class LoginServiceImpl implements ILoginService {
loginInfo.setMsg("无账号信息");
return loginInfo;
}
// if (!CaptchaUtil.checkVerificationCode(key, code, adminRedisTemplate)) {
// loginInfo.setMsg("验证码不正确");
// return loginInfo;
// }
if (!CaptchaUtil.checkVerificationCode(key, code, adminRedisTemplate)) {
loginInfo.setMsg("验证码不正确");
return loginInfo;
}
if (!BCrypt.checkpw(password, sysUser.getPassword())) {
loginInfo.setMsg("账号密码错误");
return loginInfo;