浏览代码

心中Authorize注解支持

周浩 9 年之前
父节点
当前提交
63bade1a9a

+ 3 - 3
hsweb-web-controller/src/main/java/org/hsweb/web/controller/AopAuthorizeValidatorAutoConfiguration.java

@@ -3,8 +3,8 @@ package org.hsweb.web.controller;
 import org.aspectj.lang.ProceedingJoinPoint;
 import org.aspectj.lang.annotation.Around;
 import org.aspectj.lang.annotation.Aspect;
-import org.hsweb.web.authorize.AopAuthorizeValidator;
-import org.hsweb.web.exception.AuthorizeException;
+import org.hsweb.web.core.authorize.AopAuthorizeValidator;
+import org.hsweb.web.core.exception.AuthorizeException;
 import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
@@ -25,7 +25,7 @@ public class AopAuthorizeValidatorAutoConfiguration extends AopAuthorizeValidato
     @Aspect
     @Order(1)
     static class ControllerAuthorizeValidator extends AopAuthorizeValidator {
-        @Around(value = "execution(* org.hsweb.web.controller..*Controller..*(..))")
+        @Around(value = "execution(* org.hsweb.web..controller..*Controller..*(..))||@annotation(org.hsweb.web.core.authorize.annotation.Authorize)")
         public Object around(ProceedingJoinPoint pjp) throws Throwable {
             boolean access = super.validate(pjp);
             if (!access) throw new AuthorizeException("无权限", 403);