修改服务器返回401(测试)
This commit is contained in:
@@ -1,7 +1,10 @@
|
|||||||
package com.ruoyi.framework.aspectj;
|
package com.ruoyi.framework.aspectj;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.ruoyi.common.utils.ServletUtils;
|
||||||
import org.aspectj.lang.JoinPoint;
|
import org.aspectj.lang.JoinPoint;
|
||||||
import org.aspectj.lang.annotation.Aspect;
|
import org.aspectj.lang.annotation.Aspect;
|
||||||
import org.aspectj.lang.annotation.Before;
|
import org.aspectj.lang.annotation.Before;
|
||||||
@@ -16,6 +19,8 @@ import com.ruoyi.common.utils.SecurityUtils;
|
|||||||
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
import com.ruoyi.framework.security.context.PermissionContextHolder;
|
import com.ruoyi.framework.security.context.PermissionContextHolder;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 数据过滤处理
|
* 数据过滤处理
|
||||||
*
|
*
|
||||||
@@ -55,9 +60,25 @@ public class DataScopeAspect
|
|||||||
*/
|
*/
|
||||||
public static final String DATA_SCOPE = "dataScope";
|
public static final String DATA_SCOPE = "dataScope";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 放行接口
|
||||||
|
*/
|
||||||
|
private static final List<String> IGNORE_URLS = Arrays.asList(
|
||||||
|
"/sso/pcms/code/login"
|
||||||
|
);
|
||||||
|
|
||||||
@Before("@annotation(controllerDataScope)")
|
@Before("@annotation(controllerDataScope)")
|
||||||
public void doBefore(JoinPoint point, DataScope controllerDataScope) throws Throwable
|
public void doBefore(JoinPoint point, DataScope controllerDataScope) throws Throwable
|
||||||
{
|
{
|
||||||
|
//处理放行接口
|
||||||
|
HttpServletRequest request = ServletUtils.getRequest();
|
||||||
|
if (request != null) {
|
||||||
|
String uri = request.getRequestURI();
|
||||||
|
if (IGNORE_URLS.stream().anyMatch(uri::contains)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
clearDataScope(point);
|
clearDataScope(point);
|
||||||
handleDataScope(point, controllerDataScope);
|
handleDataScope(point, controllerDataScope);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user