心中Authorize注解支持

This commit is contained in:
周浩
2016-05-07 11:39:57 +08:00
parent 8e92cdc7bc
commit 63bade1a9a

View File

@@ -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);