开启 Dubbo Provider 参数校验

This commit is contained in:
YunaiV 2020-07-17 08:19:29 +08:00
parent d619f0fae8
commit 26ea8dd907
15 changed files with 22 additions and 10 deletions

View File

@ -41,6 +41,7 @@ public class PassportManager {
public PassportAccessTokenVO login(PassportLoginDTO loginDTO, String ip) { public PassportAccessTokenVO login(PassportLoginDTO loginDTO, String ip) {
// 校验管理员密码 // 校验管理员密码
// CommonResult<AdminVO> verifyPasswordResult = adminRpc.verifyPassword(AdminPassportConvert.INSTANCE.convert(loginDTO).setIp(ip));
CommonResult<AdminVO> verifyPasswordResult = adminRpc.verifyPassword(AdminPassportConvert.INSTANCE.convert(loginDTO).setIp(ip)); CommonResult<AdminVO> verifyPasswordResult = adminRpc.verifyPassword(AdminPassportConvert.INSTANCE.convert(loginDTO).setIp(ip));
verifyPasswordResult.checkError(); verifyPasswordResult.checkError();
// 创建访问令牌 // 创建访问令牌

View File

@ -35,7 +35,7 @@
<packaging>pom</packaging> <packaging>pom</packaging>
<properties> <properties>
<springboot.version>2.2.4.RELEASE</springboot.version> <springboot.version>2.2.5.RELEASE</springboot.version>
<spring-boot-admin-starter-client.version>2.2.2</spring-boot-admin-starter-client.version> <spring-boot-admin-starter-client.version>2.2.2</spring-boot-admin-starter-client.version>
<!-- <com.alibab.dubbo.version>2.6.5</com.alibab.dubbo.version>--> <!-- <com.alibab.dubbo.version>2.6.5</com.alibab.dubbo.version>-->
<dubbo.version>2.7.4.1</dubbo.version> <dubbo.version>2.7.4.1</dubbo.version>

View File

@ -54,6 +54,11 @@
</dependency> </dependency>
<!-- 工具类相关 --> <!-- 工具类相关 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<dependency> <dependency>
<groupId>org.projectlombok</groupId> <groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId> <artifactId>lombok</artifactId>

View File

@ -13,7 +13,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import static cn.iocoder.common.framework.vo.CommonResult.success; import static cn.iocoder.common.framework.vo.CommonResult.success;
@Service(version = "${dubbo.provider.AdminRpc.version}", validation = "false") @Service(version = "${dubbo.provider.AdminRpc.version}")
public class AdminRpcImpl implements AdminRpc { public class AdminRpcImpl implements AdminRpc {
@Autowired @Autowired

View File

@ -16,7 +16,7 @@ import static cn.iocoder.common.framework.vo.CommonResult.success;
/** /**
* 部门 Rpc 实现类 * 部门 Rpc 实现类
*/ */
@Service(version = "${dubbo.provider.DepartmentRpc.version}", validation = "false") @Service(version = "${dubbo.provider.DepartmentRpc.version}")
public class DepartmentRpcImpl implements DepartmentRpc { public class DepartmentRpcImpl implements DepartmentRpc {
@Autowired @Autowired

View File

@ -15,7 +15,7 @@ import static cn.iocoder.common.framework.vo.CommonResult.success;
/** /**
* 数据字典 Rpc 实现类 * 数据字典 Rpc 实现类
*/ */
@Service(version = "${dubbo.provider.DataDictRpc.version}", validation = "false") @Service(version = "${dubbo.provider.DataDictRpc.version}")
public class DataDictRpcImpl implements DataDictRpc { public class DataDictRpcImpl implements DataDictRpc {
@Autowired @Autowired

View File

@ -10,7 +10,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import static cn.iocoder.common.framework.vo.CommonResult.success; import static cn.iocoder.common.framework.vo.CommonResult.success;
@Service(version = "${dubbo.provider.OAuth2Rpc.version}", validation = "false") @Service(version = "${dubbo.provider.OAuth2Rpc.version}")
public class OAuth2RpcImpl implements OAuth2Rpc { public class OAuth2RpcImpl implements OAuth2Rpc {
@Autowired @Autowired

View File

@ -17,7 +17,7 @@ import static cn.iocoder.common.framework.vo.CommonResult.success;
/** /**
* 权限 Rpc 实现类 * 权限 Rpc 实现类
*/ */
@Service(version = "${dubbo.provider.PermissionRpc.version}", validation = "false") @Service(version = "${dubbo.provider.PermissionRpc.version}")
public class PermissionRpcImpl implements PermissionRpc { public class PermissionRpcImpl implements PermissionRpc {
@Autowired @Autowired

View File

@ -16,7 +16,7 @@ import static cn.iocoder.common.framework.vo.CommonResult.success;
/** /**
* 资源 Rpc 实现类 * 资源 Rpc 实现类
*/ */
@Service(version = "${dubbo.provider.ResourceRpc.version}", validation = "false") @Service(version = "${dubbo.provider.ResourceRpc.version}")
public class ResourceRpcImpl implements ResourceRpc { public class ResourceRpcImpl implements ResourceRpc {
@Autowired @Autowired

View File

@ -19,7 +19,7 @@ import static cn.iocoder.common.framework.vo.CommonResult.success;
/** /**
* 角色 Rpc 实现类 * 角色 Rpc 实现类
*/ */
@Service(version = "${dubbo.provider.RoleRpc.version}", validation = "false") @Service(version = "${dubbo.provider.RoleRpc.version}")
public class RoleRpcImpl implements RoleRpc { public class RoleRpcImpl implements RoleRpc {
@Autowired @Autowired

View File

@ -14,7 +14,7 @@ import static cn.iocoder.common.framework.vo.CommonResult.success;
/** /**
* 系统访问日志 Rpc 实现类 * 系统访问日志 Rpc 实现类
*/ */
@Service(version = "${dubbo.provider.SystemAccessLogRpc.version}", validation = "false") @Service(version = "${dubbo.provider.SystemAccessLogRpc.version}")
public class SystemAccessLogRpcImpl implements SystemAccessLogRpc { public class SystemAccessLogRpcImpl implements SystemAccessLogRpc {
@Autowired @Autowired

View File

@ -12,7 +12,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import static cn.iocoder.common.framework.vo.CommonResult.success; import static cn.iocoder.common.framework.vo.CommonResult.success;
@Service(version = "${dubbo.provider.SystemExceptionLogRpc.version}", validation = "false") @Service(version = "${dubbo.provider.SystemExceptionLogRpc.version}")
public class SystemExceptionLogRpcImpl implements SystemExceptionLogRpc { public class SystemExceptionLogRpcImpl implements SystemExceptionLogRpc {
@Autowired @Autowired

View File

@ -33,6 +33,7 @@ dubbo:
# Dubbo 服务提供者的配置 # Dubbo 服务提供者的配置
provider: provider:
filter: -exception filter: -exception
validation: true # 开启 Provider 参数校验
OAuth2Rpc: OAuth2Rpc:
version: 1.0.0 version: 1.0.0
AdminRpc: AdminRpc:

View File

@ -54,6 +54,10 @@
</dependency> </dependency>
<!-- 工具类相关 --> <!-- 工具类相关 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<dependency> <dependency>
<groupId>org.projectlombok</groupId> <groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId> <artifactId>lombok</artifactId>

View File

@ -33,6 +33,7 @@ dubbo:
# Dubbo 服务提供者的配置 # Dubbo 服务提供者的配置
provider: provider:
filter: -exception filter: -exception
validation: true # 开启 Provider 参数校验
UserRpc: UserRpc:
version: 1.0.0 version: 1.0.0
UserSmsCodeRpc: UserSmsCodeRpc: