Merge branch 'new_3A' of https://axzsource.com/infra/axzo-framework.git into new_3A
This commit is contained in:
commit
990fd2493d
@ -1,19 +1,5 @@
|
||||
package cn.axzo.framework.auth.service;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.aspectj.lang.ProceedingJoinPoint;
|
||||
import org.aspectj.lang.annotation.Around;
|
||||
import org.aspectj.lang.annotation.Aspect;
|
||||
import org.aspectj.lang.reflect.MethodSignature;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
|
||||
import cn.axzo.framework.auth.AuthException;
|
||||
import cn.axzo.framework.auth.annotation.PreBuildContext;
|
||||
import cn.axzo.framework.auth.constants.AuthConstants;
|
||||
@ -34,8 +20,21 @@ import cn.hutool.core.text.CharSequenceUtil;
|
||||
import cn.hutool.http.HttpException;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.aspectj.lang.ProceedingJoinPoint;
|
||||
import org.aspectj.lang.annotation.Around;
|
||||
import org.aspectj.lang.annotation.Aspect;
|
||||
import org.aspectj.lang.annotation.Pointcut;
|
||||
import org.aspectj.lang.reflect.MethodSignature;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
|
||||
@Slf4j
|
||||
@Aspect
|
||||
@ -58,12 +57,46 @@ public class ContextInfoBuilderAspect {
|
||||
return (String) podNamespacePropertyDefiner.getSystemProperties().get("CUSTOM_ENV");
|
||||
}
|
||||
|
||||
@Around(value = "@within(preBuildContext)")
|
||||
public Object classHandler(ProceedingJoinPoint pjp, PreBuildContext preBuildContext) {
|
||||
@Pointcut(value = "@annotation(org.springframework.web.bind.annotation.RequestMapping)")
|
||||
public void requestMapping() {
|
||||
}
|
||||
|
||||
@Pointcut(value = "@annotation(org.springframework.web.bind.annotation.PostMapping)")
|
||||
public void postMapping() {
|
||||
}
|
||||
|
||||
@Pointcut(value = "@annotation(org.springframework.web.bind.annotation.GetMapping)")
|
||||
public void getMapping() {
|
||||
}
|
||||
|
||||
@Pointcut(value = "@annotation(org.springframework.web.bind.annotation.PutMapping)")
|
||||
public void putMapping() {
|
||||
}
|
||||
|
||||
@Pointcut(value = "@annotation(org.springframework.web.bind.annotation.DeleteMapping)")
|
||||
public void deleteMapping() {
|
||||
}
|
||||
|
||||
@Pointcut(value = "@annotation(org.springframework.web.bind.annotation.PatchMapping)")
|
||||
public void patchMapping() {
|
||||
}
|
||||
|
||||
@Pointcut("requestMapping() || postMapping() || getMapping() || putMapping() || deleteMapping()|| patchMapping()")
|
||||
public void mappingAnnotations() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 切入含有@PreBuildContext && @RestController 注解的类
|
||||
*/
|
||||
@Around(value = "@within(preBuildContext) && @within(restController)")
|
||||
public Object classHandler(ProceedingJoinPoint pjp, PreBuildContext preBuildContext, RestController restController) {
|
||||
return handle(pjp, preBuildContext);
|
||||
}
|
||||
|
||||
@Around(value = "@annotation(preBuildContext)")
|
||||
/**
|
||||
* 切入含有@PreBuildContext && @RequestMapping/@PostMapping/@GetMapping/@PutMapping/@DeleteMapping/@PatchMapping 之一注解的方法
|
||||
*/
|
||||
@Around(value = "@annotation(preBuildContext) && mappingAnnotations()")
|
||||
public Object methodHandler(ProceedingJoinPoint pjp, PreBuildContext preBuildContext) {
|
||||
return handle(pjp, preBuildContext);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user