|
@@ -37,28 +37,29 @@ public class UserAuthorizationInterceptor implements HandlerInterceptor{
|
|
|
|
|
|
System system = systemService.getSystem();
|
|
System system = systemService.getSystem();
|
|
|
|
|
|
- String referer = request.getHeader("referer");
|
|
|
|
- if(StrUtil.isNotBlank(referer)) {
|
|
|
|
- if (!referer.startsWith(system.getWebsite())) {
|
|
|
|
- throw new UnauthorizedException("访问来源不合法");
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (referer.startsWith("http://cms.iteachyou.cc/") || referer.startsWith("https://cms.iteachyou.cc/")) {
|
|
|
|
- if (handler instanceof HandlerMethod) {
|
|
|
|
- HandlerMethod handlerMethod = (HandlerMethod) handler;
|
|
|
|
- Log annotation = handlerMethod.getMethodAnnotation(Log.class);
|
|
|
|
- if (annotation == null) {
|
|
|
|
- return Boolean.TRUE;
|
|
|
|
- }
|
|
|
|
- OperatorType operType = annotation.operType();
|
|
|
|
- if (!OperatorType.PAGE.equals(operType) && !OperatorType.SELECT.equals(operType) && !OperatorType.OTHER.equals(operType)) {
|
|
|
|
- throw new UnauthorizedException("演示环境不允许操作");
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }else{
|
|
|
|
- throw new UnauthorizedException("访问来源不合法");
|
|
|
|
- }
|
|
|
|
|
|
+// String referer = request.getHeader("referer");
|
|
|
|
+// if(StrUtil.isNotBlank(referer)) {
|
|
|
|
+// if (!referer.startsWith(system.getWebsite())) {
|
|
|
|
+// throw new UnauthorizedException("访问来源不合法");
|
|
|
|
+// }
|
|
|
|
+//
|
|
|
|
+// //if (referer.startsWith("http://localhost/") || referer.startsWith("https://localhost/")) {
|
|
|
|
+// if (referer.startsWith("http://localhost:8888/") ) {
|
|
|
|
+// if (handler instanceof HandlerMethod) {
|
|
|
|
+// HandlerMethod handlerMethod = (HandlerMethod) handler;
|
|
|
|
+// Log annotation = handlerMethod.getMethodAnnotation(Log.class);
|
|
|
|
+// if (annotation == null) {
|
|
|
|
+// return Boolean.TRUE;
|
|
|
|
+// }
|
|
|
|
+// OperatorType operType = annotation.operType();
|
|
|
|
+// if (!OperatorType.PAGE.equals(operType) && !OperatorType.SELECT.equals(operType) && !OperatorType.OTHER.equals(operType)) {
|
|
|
|
+// throw new UnauthorizedException("演示环境不允许操作");
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+// }else{
|
|
|
|
+// throw new UnauthorizedException("访问来源不合法");
|
|
|
|
+// }
|
|
log.info("UserAuthorizationInterceptor:["+token+"]拦截通过...");
|
|
log.info("UserAuthorizationInterceptor:["+token+"]拦截通过...");
|
|
return Boolean.TRUE;
|
|
return Boolean.TRUE;
|
|
}
|
|
}
|