mirror of
https://github.com/hs-web/hsweb-framework.git
synced 2026-06-21 18:02:48 +08:00
心中Authorize注解支持
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user