POST /auth/register

使用用户名、邮箱、手机号和密码创建账户,支持开放注册、邀请注册和审批三种成员加入方式。创建成功后自动发送欢迎通知。参考:OWASP ASVS V2.2。

身份认证 None application/json

请求体

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

字段类型必填示例约束描述
password string 是 length: 8–256 Password or hash/ciphertext
birth_date string 否 Birth date (format: "2006-01-02")
client_nonce string 否 hash 模式: 客户端随机 nonce
email string 否 Email
initial_role string 否 InitialRole 开通链初始角色(super_admin|admin|member)。仅当 X-API-Key 命中内部 key 时生效, 其余场景静默忽略(fail-closed,防公开注册提权)。试用/建租户链由 service-tenant 内部调用设置。
invitation_code string 否 邀请码(invitation_only 模式下必填)
password_transmission string 否 plain|hash|symmetric|asymmetric
phone string 否 Phone
tenant_id string 否 对齐 LoginRequest — 若填写则覆盖 header 推导值
username string 否 length: 3–32 Username

响应

状态描述Schema
201注册成功,返回用户ID和状态service-identity/internal/handler/dto.RegisterResponse
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.RegisterResponse

用户注册结果

字段类型必填示例约束描述
membership_status string 否 pending 成员状态(审批模式下为 pending)
message string 否 registration successful Message
status string 否 active Status
user_id string 否 usr_abc123 User ID