ソースを参照

优化aop拦截规则

zhouhao 8 年 前
コミット
4124897ec5

+ 10 - 4
hsweb-authorization/hsweb-authorization-shiro/src/main/java/org/hswebframework/web/authorization/shiro/ShiroAutoconfiguration.java

@@ -182,10 +182,16 @@ public class ShiroAutoconfiguration {
     @Aspect
     @Order(Ordered.HIGHEST_PRECEDENCE)
     static class MethodInterceptorHolderAdvisor {
-        @Around(value = "@annotation(org.hswebframework.web.authorization.annotation.RequiresExpression)" +
-                "||@annotation(org.hswebframework.web.authorization.annotation.RequiresDataAccess)" +
-                "||@annotation(org.hswebframework.web.authorization.annotation.Authorize)" +
-                "||within(@org.hswebframework.web.authorization.annotation.Authorize *)")
+        @Around(value = "@annotation(org.hswebframework.web.authorization.annotation.RequiresExpression)"
+                + "||@annotation(org.hswebframework.web.authorization.annotation.RequiresDataAccess)"
+                + "||@annotation(org.hswebframework.web.authorization.annotation.Authorize)"
+                + "||("
+                + "within(@org.hswebframework.web.authorization.annotation.Authorize *) "
+                + "&& ("
+                + "@annotation(org.springframework.web.bind.annotation.RequestMapping)||"
+                + "execution(org.hswebframework.web.controller.message.ResponseMessage *(..)"
+                + ")))"
+        )
         public Object around(ProceedingJoinPoint pjp) throws Throwable {
             MethodSignature signature = (MethodSignature) pjp.getSignature();
             String methodName = AopUtils.getMethodBody(pjp);