提交 | 用户 | 时间
|
e7c126
|
1 |
package com.iailab.module.system.controller.admin.oauth2.vo.client; |
H |
2 |
|
|
3 |
import cn.hutool.core.util.StrUtil; |
|
4 |
import com.iailab.framework.common.util.json.JsonUtils; |
|
5 |
import io.swagger.v3.oas.annotations.media.Schema; |
|
6 |
import lombok.Data; |
|
7 |
import org.hibernate.validator.constraints.URL; |
|
8 |
|
|
9 |
import javax.validation.constraints.AssertTrue; |
|
10 |
import javax.validation.constraints.NotEmpty; |
|
11 |
import javax.validation.constraints.NotNull; |
|
12 |
import java.util.List; |
|
13 |
|
|
14 |
@Schema(description = "管理后台 - OAuth2 客户端创建/修改 Request VO") |
|
15 |
@Data |
|
16 |
public class OAuth2ClientSaveReqVO { |
|
17 |
|
|
18 |
@Schema(description = "编号", example = "1024") |
|
19 |
private Long id; |
|
20 |
|
|
21 |
@Schema(description = "客户端编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "tudou") |
|
22 |
@NotNull(message = "客户端编号不能为空") |
|
23 |
private String clientId; |
|
24 |
|
|
25 |
@Schema(description = "客户端密钥", requiredMode = Schema.RequiredMode.REQUIRED, example = "fan") |
|
26 |
@NotNull(message = "客户端密钥不能为空") |
|
27 |
private String secret; |
|
28 |
|
|
29 |
@Schema(description = "应用名", requiredMode = Schema.RequiredMode.REQUIRED, example = "土豆") |
|
30 |
@NotNull(message = "应用名不能为空") |
|
31 |
private String name; |
|
32 |
|
|
33 |
@Schema(description = "应用图标", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://www.baidu.com/xx.png") |
|
34 |
@NotNull(message = "应用图标不能为空") |
|
35 |
@URL(message = "应用图标的地址不正确") |
|
36 |
private String logo; |
|
37 |
|
|
38 |
@Schema(description = "应用描述", example = "我是一个应用") |
|
39 |
private String description; |
|
40 |
|
|
41 |
@Schema(description = "状态,参见 CommonStatusEnum 枚举", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") |
|
42 |
@NotNull(message = "状态不能为空") |
|
43 |
private Integer status; |
|
44 |
|
|
45 |
@Schema(description = "访问令牌的有效期", requiredMode = Schema.RequiredMode.REQUIRED, example = "8640") |
|
46 |
@NotNull(message = "访问令牌的有效期不能为空") |
|
47 |
private Integer accessTokenValiditySeconds; |
|
48 |
|
|
49 |
@Schema(description = "刷新令牌的有效期", requiredMode = Schema.RequiredMode.REQUIRED, example = "8640000") |
|
50 |
@NotNull(message = "刷新令牌的有效期不能为空") |
|
51 |
private Integer refreshTokenValiditySeconds; |
|
52 |
|
|
53 |
@Schema(description = "可重定向的 URI 地址", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://www.baidu.com") |
|
54 |
@NotNull(message = "可重定向的 URI 地址不能为空") |
|
55 |
private List<@NotEmpty(message = "重定向的 URI 不能为空") @URL(message = "重定向的 URI 格式不正确") String> redirectUris; |
|
56 |
|
|
57 |
@Schema(description = "授权类型,参见 OAuth2GrantTypeEnum 枚举", requiredMode = Schema.RequiredMode.REQUIRED, example = "password") |
|
58 |
@NotNull(message = "授权类型不能为空") |
|
59 |
private List<String> authorizedGrantTypes; |
|
60 |
|
|
61 |
@Schema(description = "授权范围", example = "user_info") |
|
62 |
private List<String> scopes; |
|
63 |
|
|
64 |
@Schema(description = "自动通过的授权范围", example = "user_info") |
|
65 |
private List<String> autoApproveScopes; |
|
66 |
|
|
67 |
@Schema(description = "权限", example = "system:user:query") |
|
68 |
private List<String> authorities; |
|
69 |
|
|
70 |
@Schema(description = "资源", example = "1024") |
|
71 |
private List<String> resourceIds; |
|
72 |
|
|
73 |
@Schema(description = "附加信息", example = "{yunai: true}") |
|
74 |
private String additionalInformation; |
|
75 |
|
|
76 |
@AssertTrue(message = "附加信息必须是 JSON 格式") |
|
77 |
public boolean isAdditionalInformationJson() { |
|
78 |
return StrUtil.isEmpty(additionalInformation) || JsonUtils.isJson(additionalInformation); |
|
79 |
} |
|
80 |
|
|
81 |
} |