GenerateRequestToken.java 1.22 KB
package com.huaheng.control.management.dto;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

@Data
@Schema(title = "GenerateRequestToken", description = "TOKEN生成请求对象")
public class GenerateRequestToken {

    /** TOKEN提供方 */
    @Schema(description = "TOKEN提供方", example = "CMC")
    @NotNull()
    private String operator;

    /** TOKEN使用方 */
    @Schema(description = "TOKEN使用方", example = "audience")
    @NotNull()
    private String audience;

    /** 过期时间 yyyy-MM-dd HH:mm:ss */
    @Schema(description = "过期时间", example = "2099-12-31 23:59:59")
    @NotNull()
    @Pattern(message = "expirationTime must match the required pattern yyyy-MM-dd HH:mm:ss",
        regexp = "^((([0-9]{3}[1-9]|[0-9]{2}[1-9][0-9]{1}|[0-9]{1}[1-9][0-9]{2}|[1-9][0-9]{3})-(((0[13578]|1[02])-(0[1-9]|[12][0-9]|3[01]))|"
            + "((0[469]|11)-(0[1-9]|[12][0-9]|30))|(02-(0[1-9]|[1][0-9]|2[0-8]))))|((([0-9]{2})(0[48]|[2468][048]|[13579][26])|((0[48]|[2468][048]|"
            + "[3579][26])00))-02-29))\\s+([0-1]?[0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9])$")
    private String expirationTime;
}