Add two-factor api

This commit is contained in:
2024-02-29 19:33:26 +08:00
parent 376ef81950
commit b52ce7f5e8
31 changed files with 709 additions and 25 deletions

View File

@@ -34,5 +34,14 @@ data class LoginParam(
*/
@Schema(description = "密码", required = true)
@field:NotBlank(message = "Password can not be blank")
val password: String?
val password: String?,
/**
* Two-factor code
*
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Schema(description = "二步验证码")
val twoFactorCode: String?
) : CaptchaCodeParam()

View File

@@ -0,0 +1,23 @@
package top.fatweb.oxygen.api.param.permission
import io.swagger.v3.oas.annotations.media.Schema
import jakarta.validation.constraints.NotBlank
/**
* Validate two-factor parameters
*
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Schema(description = "验证二步验证请求参数")
data class TwoFactorValidateParam(
/**
* Code
*
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Schema(description = "验证码")
@field:NotBlank(message = "Code can not be blank")
val code: String?
)

View File

@@ -0,0 +1,37 @@
package top.fatweb.oxygen.api.param.system
import io.swagger.v3.oas.annotations.media.Schema
import jakarta.validation.constraints.Min
import jakarta.validation.constraints.NotNull
import top.fatweb.oxygen.api.annotation.Trim
/**
* Two-factor settings parameters
*
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Trim
@Schema(description = "二步验证设置请求参数")
data class TwoFactorSettingsParam(
/**
* Issuer
*
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Trim
@Schema(description = "发布者")
var issuer: String?,
/**
* Length of secret key
*
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Schema(description = "密钥长度")
@field:NotNull(message = "Length of secret key can not be null")
@field:Min(value = 3, message = "The length of the key must be greater than or equal to 3")
val secretKeyLength: Int?
)