消息验证 切面

v1.4.1
Parker 4 years ago
parent 50c9da1eed
commit a549f911e6

@ -0,0 +1,47 @@
package org.opsli.core.aspect;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.opsli.api.base.warpper.ApiWrapper;
import org.opsli.api.utils.ValidationUtil;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
import static org.opsli.common.constants.OrderConstants.PARAM_VALIDATE_AOP_SORT;
/**
*
*
* @author parker
* @date 2020-09-16
*/
@Slf4j
@Order(PARAM_VALIDATE_AOP_SORT)
@Aspect
@Component
public class ValitaionArgsAop {
@Pointcut("execution(public * org.opsli.modulars*..*.*Controller*.*(..))")
public void requestMapping() {
}
/**
* post
* @param point
*/
@Before("requestMapping()")
public void doBefore(JoinPoint point) {
Object[] args = point.getArgs();
for (Object arg : args) {
// 参数校验
if(arg instanceof ApiWrapper){
ValidationUtil.verify(arg);
}
}
}
}
Loading…
Cancel
Save