/mfa/totp/setup
为用户启用基于时间的一次性密码(TOTP)认证,生成密钥和二维码,返回备用恢复码。参考:RFC 6238 (TOTP)、OWASP ASVS V2.8.3。
Request Body
Schema: dto.TOTPEnableRequest
| Field | Type | Required | Example | Constraints | Description |
|---|---|---|---|---|---|
account |
string |
No | |||
device_name |
string |
No |
Responses
| Status | Description | Schema |
|---|---|---|
| 200 | TOTP配置信息,包含密钥URL和二维码 | dto.TOTPEnableDetailResponse |
| 400 | 参数错误或TOTP已启用 | gitee_com_linmes_authms_base_dto.SimpleResponse |
| 401 | 未认证 | gitee_com_linmes_authms_base_dto.SimpleResponse |
| 500 | 服务器内部错误 | gitee_com_linmes_authms_base_dto.SimpleResponse |
Referenced Schemas
dto.TOTPEnableDetailResponse
| Field | Type | Required | Example | Constraints | Description |
|---|---|---|---|---|---|
code |
integer |
No | |||
data |
dto.TOTPEnableResponse |
No | |||
message |
string |
No | |||
timestamp |
string |
No |
dto.TOTPEnableResponse
| Field | Type | Required | Example | Constraints | Description |
|---|---|---|---|---|---|
backup_codes |
array of string |
No | ['["12345678"', '"23456789"]'] |
||
qr_code |
string |
No | data:image/png;base64,iVBORw0KGgo... |
||
qr_code_url |
string |
No | otpauth://totp/AuthMS:user@example.com?secret=JBSWY3DPEHPK3PXP&issuer=AuthMS |
||
secret |
string |
No | JBSWY3DPEHPK3PXP |
||
setup_url |
string |
No | https://auth.example.com/mfa/totp/setup |
gitee_com_linmes_authms_base_dto.SimpleResponse
| Field | Type | Required | Example | Constraints | Description |
|---|---|---|---|---|---|
code |
integer |
No | |||
message |
string |
No | |||
timestamp |
string |
No |