fix:添加请求参数校验

This commit is contained in:
“袁杰” 2021-07-28 20:26:11 +08:00
parent e7e8b6a9fd
commit 7232cc5120
3 changed files with 49 additions and 2 deletions

View File

@ -0,0 +1,18 @@
package cn.axzo.oss.client.config;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* @program: oss
* @description: 访问校验
* @author: mr.jie
* @date: 2021-07-28 00:50
**/
@Target({ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
public @interface ApiAccessCheck {
}

View File

@ -0,0 +1,29 @@
package cn.axzo.oss.client.config.resolver;
import cn.axzo.oss.client.config.ApiAccessCheck;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.stereotype.Component;
/**
* @program: oss
* @description: 访问校验实现
* @author: mr.jie
* @date: 2021-07-28 01:23
**/
@Aspect
@Component
@Slf4j
public class ApiAccessCheckResolver {
@Around("@annotation(apiAccessCheck)")
public Object methodHandler(ProceedingJoinPoint jp, ApiAccessCheck apiAccessCheck)
throws Throwable {
Object result = jp.proceed();
return result;
}
}

View File

@ -6,10 +6,10 @@ spring:
config:
server-addr: ${NACOS_HOST:dev-nacos.axzo.cn}:${NACOS_PORT:80}
file-extension: yaml
namespace: ${NACOS_NAMESPACE_ID:35eada10-9574-4db8-9fea-bc6a4960b6c7}
namespace: ${NACOS_NAMESPACE_ID:f82179f1-81a9-41a1-a489-4f9ab5660a6e}
prefix: ${spring.application.name}
profiles:
active: ${NACOS_PROFILES_ACTIVE:dev}
active: ${NACOS_PROFILES_ACTIVE:local}
main:
allow-bean-definition-overriding: true