das接口修改
This commit is contained in:
parent
48cf136b8d
commit
2a43e8f33c
@ -1,6 +1,9 @@
|
||||
package com.das.common.interceptor;
|
||||
|
||||
|
||||
import cn.dev33.satoken.exception.NotLoginException;
|
||||
import cn.dev33.satoken.exception.NotPermissionException;
|
||||
import cn.dev33.satoken.exception.NotRoleException;
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import cn.hutool.core.io.IoUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
@ -44,6 +47,18 @@ public class DecryptingOncePerRequestFilter extends OncePerRequestFilter {
|
||||
//如果获取到token,则进行解密
|
||||
if (StrUtil.isNotBlank(token)) {
|
||||
token = AESUtil.decrypt(aesKey, token, iv);
|
||||
try {
|
||||
// 检查Token
|
||||
StpUtil.checkLogin();
|
||||
} catch (NotLoginException e) {
|
||||
// 处理未登录异常
|
||||
response.sendError(401, "未登录");
|
||||
return;
|
||||
} catch (NotRoleException | NotPermissionException e) {
|
||||
// 处理权限异常
|
||||
response.sendError(403, "无权限访问");
|
||||
return;
|
||||
}
|
||||
}
|
||||
//如果读取到requestBody,则进行解密
|
||||
String bodyData = readRequestBody(request);
|
||||
@ -59,6 +74,18 @@ public class DecryptingOncePerRequestFilter extends OncePerRequestFilter {
|
||||
//如果获取到token,则进行解密
|
||||
if (StrUtil.isNotBlank(token)) {
|
||||
token = AESUtil.decrypt(aesKey, token, iv);
|
||||
try {
|
||||
// 检查Token
|
||||
StpUtil.checkLogin();
|
||||
} catch (NotLoginException e) {
|
||||
// 处理未登录异常
|
||||
response.sendError(401, "未登录");
|
||||
return;
|
||||
} catch (NotRoleException | NotPermissionException e) {
|
||||
// 处理权限异常
|
||||
response.sendError(403, "无权限访问");
|
||||
return;
|
||||
}
|
||||
}
|
||||
String id = request.getParameter("id");
|
||||
if (StrUtil.isNotBlank(id)) {
|
||||
|
Loading…
Reference in New Issue
Block a user