POST /auth/register/invitation

通过有效的租户邀请码完成注册,邀请码由租户管理员生成。注册成功后自动接受邀请并加入租户,返回JWT令牌。参考:OWASP ASVS V2.2。

身份认证 None application/json

请求体

Schema: service-identity/internal/handler/dto.RegisterByInvitationRequest

字段类型必填示例约束描述
invitation_code string 是
password string 是 length: 8–256
username string 是 length: 3–32
password_transmission string 否
tenant_id string 否 TenantID 可选:仅用于邀请一致性校验(body 显式租户);不参与租户解析。

响应

状态描述Schema
200注册成功并自动登录service-identity/internal/handler/dto.LoginResponse
400请求参数无效或邀请码已失效service-core/base/dto.SimpleResponse
500服务器内部错误service-core/base/dto.SimpleResponse

引用的 Schema

service-core/base/dto.SimpleResponse

字段类型必填示例约束描述
code integer 否
message string 否
timestamp string 否

service-identity/internal/handler/dto.LoginResponse

用户登录结果

字段类型必填示例约束描述
access_token string 否 eyJhbGciOi... Access token
challenge_token string 否 chg_abc123... MFA challenge token (short-lived, requires MFA verification)
enrolled_mfa_methods array of

string

否 用户已开通的 MFA 方法(挑战页仅展示这些)
expires_in integer 否 1800 Expiration time
membership_status string 否 pending MembershipStatus 新注册待审批(WS-A A3);pending 时不返回 token。
mfa_check_reason string 否 new_device MFA触发原因描述
must_change_password boolean 否 False Password must be changed
password_expires_in integer 否 30 Days until password expires
password_warning string 否 expiring Password warning: expiring/expired_grace/expired
refresh_token string 否 eyJhbGciOi... Refresh token
required_mfa_methods array of

string

否 MFA推荐方法列表
requires_mfa boolean 否 False 自适应MFA: 需要额外MFA验证
risk_assessment object 否 Risk assessment
risk_level string 否 low 风险等级: low/medium/high
token_type string 否 Bearer Token type
user object 否 User info
user_id string 否 User ID (redundant with User.ID for flat access)

service-identity/internal/handler/dto.RiskAssessmentInfo

字段类型必填示例约束描述
level string 否
recommended_mfa_methods array of

string

否
require_mfa boolean 否
score integer 否

service-identity/internal/handler/dto.UserInfo

用户基本信息

字段类型必填示例约束描述
created_at string 否 2026-01-15T10:30:00Z Account creation time
email string 否 john@example.com Email
id string 否 usr_abc123 User ID
last_login_at string 否 2026-07-20T08:00:00Z Last login time
metadata object 否 AUTH-44:metadata 仅 /auth/me 回传(portal 偏好等);其余构造点省略。
mfa_enabled boolean 否 True AUTH-44:指针 + omitempty —— 仅权威构造点(/auth/me)填充;其余构造点省略该键, 避免登录响应等处误报 mfa_enabled=false(零值不等于"未启用")。
must_change_password boolean 否 False Password must be changed
password_expires_in integer 否 30 Days until password expires
password_warning string 否 expiring Password warning: expiring/expired_grace/expired
phone string 否 13800138000 Phone
status string 否 active Status
username string 否 john.doe Username