Browse Source

1、模块授权拦截器增加开关

master
bjang03 4 months ago
parent
commit
80bfc1f895
  1. 3
      win-module-system/win-module-system-biz/src/main/java/com/win/module/system/framework/web/config/ModuleAuthenInterceptor.java

3
win-module-system/win-module-system-biz/src/main/java/com/win/module/system/framework/web/config/ModuleAuthenInterceptor.java

@ -20,6 +20,7 @@ import java.time.format.DateTimeFormatter;
@Slf4j @Slf4j
public class ModuleAuthenInterceptor implements HandlerInterceptor { public class ModuleAuthenInterceptor implements HandlerInterceptor {
private MD5 md5 = MD5.create(); private MD5 md5 = MD5.create();
private Boolean onOff = false;
public int findThirdOccurrence(String str, char c) { public int findThirdOccurrence(String str, char c) {
int count = 0; int count = 0;
int index = -1; int index = -1;
@ -33,6 +34,7 @@ public class ModuleAuthenInterceptor implements HandlerInterceptor {
} }
@Override @Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
if (onOff){
String[] uris = request.getRequestURI().split("admin-api"); String[] uris = request.getRequestURI().split("admin-api");
String uri = uris[uris.length-1]; String uri = uris[uris.length-1];
String moduleName = uri.substring(0,findThirdOccurrence(uri,'/')); String moduleName = uri.substring(0,findThirdOccurrence(uri,'/'));
@ -51,6 +53,7 @@ public class ModuleAuthenInterceptor implements HandlerInterceptor {
return false; return false;
} }
} }
}
return true; return true;
} }

Loading…
Cancel
Save