A AuthMS API Wiki API Reference iam.tianv.com →

POST /auth/me/switch-tenant

验证用户在新租户下的成员资格,检查跨租户切换策略,验证通过后签发新JWT令牌(含新租户的角色和权限)。参考:NIST SP 800-53 AC-2、OWASP ASVS V1.2。

身份认证 `bearerAuth` application/json

Request Body

Schema: dto.SwitchTenantRequest

FieldTypeRequiredExampleConstraintsDescription
tenant_id string Yes

Responses

StatusDescriptionSchema
200租户切换成功,返回新JWT令牌dto.SwitchTenantResponseWrapper
400请求参数无效gitee_com_linmes_authms_base_dto.SimpleResponse
401未认证或令牌无效gitee_com_linmes_authms_base_dto.SimpleResponse
403无目标租户成员资格或跨租户切换被禁用gitee_com_linmes_authms_base_dto.SimpleResponse
500服务器内部错误gitee_com_linmes_authms_base_dto.SimpleResponse

Referenced Schemas

dto.SwitchTenantResponse

FieldTypeRequiredExampleConstraintsDescription
access_token string No
expires_in integer No
refresh_token string No
token_type string No
user dto.UserInfo No

dto.SwitchTenantResponseWrapper

FieldTypeRequiredExampleConstraintsDescription
code integer No
data dto.SwitchTenantResponse No
message string No
timestamp string No

dto.UserInfo

用户基本信息

FieldTypeRequiredExampleConstraintsDescription
created_at string No Account creation time
email string No Email
id string No User ID
must_change_password boolean No Password must be changed
password_expires_in integer No Days until password expires
password_warning string No Password warning: expiring/expired_grace/expired
phone string No Phone
status string No Status
username string No Username

gitee_com_linmes_authms_base_dto.SimpleResponse

FieldTypeRequiredExampleConstraintsDescription
code integer No
message string No
timestamp string No