用户 API Key 管理:增删查、启用签名凭据;升级 SDK
CI / test (push) Successful in 48s

This commit is contained in:
2026-07-22 19:38:14 +08:00
parent 8894330eba
commit a95a8255bf
13 changed files with 1032 additions and 4 deletions
+193
View File
@@ -1572,6 +1572,43 @@ const docTemplate = `{
}
}
},
"/api/v1/oci-configs/{id}/activate-api-key": {
"post": {
"security": [
{
"BearerAuth": []
}
],
"description": "将刚创建的 key 设为本配置签名凭据:验证可用后落库,不删除旧 key;私钥为创建时下发的那份回传。",
"tags": [
"租户 IAM"
],
"summary": "启用 API Key 为面板签名凭据",
"parameters": [
{
"type": "integer",
"description": "配置 ID",
"name": "id",
"in": "path",
"required": true
},
{
"description": "请求体:fingerprint 与 privateKey",
"name": "body",
"in": "body",
"required": true,
"schema": {
"type": "object"
}
}
],
"responses": {
"204": {
"description": "无内容"
}
}
}
},
"/api/v1/oci-configs/{id}/audit-events": {
"get": {
"security": [
@@ -5795,6 +5832,77 @@ const docTemplate = `{
}
},
"/api/v1/oci-configs/{id}/users/{userId}/api-keys": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"tags": [
"租户 IAM"
],
"summary": "列出用户 API Key",
"parameters": [
{
"type": "integer",
"description": "配置 ID",
"name": "id",
"in": "path",
"required": true
},
{
"type": "string",
"description": "userId",
"name": "userId",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/internal_api.userApiKeysResponse"
}
}
}
},
"post": {
"security": [
{
"BearerAuth": []
}
],
"description": "后端生成 RSA-2048 密钥对并上传公钥;私钥仅本次响应返回,不落库。",
"tags": [
"租户 IAM"
],
"summary": "为用户新增 API Key",
"parameters": [
{
"type": "integer",
"description": "配置 ID",
"name": "id",
"in": "path",
"required": true
},
{
"type": "string",
"description": "userId",
"name": "userId",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/oci-portal_internal_service.CreatedApiKey"
}
}
}
},
"delete": {
"security": [
{
@@ -5831,6 +5939,48 @@ const docTemplate = `{
}
}
},
"/api/v1/oci-configs/{id}/users/{userId}/api-keys/{fingerprint}": {
"delete": {
"security": [
{
"BearerAuth": []
}
],
"description": "当前配置正在使用的 key 拒删(409),避免面板失联。",
"tags": [
"租户 IAM"
],
"summary": "删除用户单把 API Key",
"parameters": [
{
"type": "integer",
"description": "配置 ID",
"name": "id",
"in": "path",
"required": true
},
{
"type": "string",
"description": "userId",
"name": "userId",
"in": "path",
"required": true
},
{
"type": "string",
"description": "key 指纹",
"name": "fingerprint",
"in": "path",
"required": true
}
],
"responses": {
"204": {
"description": "无内容"
}
}
}
},
"/api/v1/oci-configs/{id}/users/{userId}/mfa-devices": {
"delete": {
"security": [
@@ -8612,6 +8762,17 @@ const docTemplate = `{
}
}
},
"internal_api.userApiKeysResponse": {
"type": "object",
"properties": {
"items": {
"type": "array",
"items": {
"$ref": "#/definitions/oci-portal_internal_service.UserApiKeyInfo"
}
}
}
},
"internal_api.webConsoleSessionResponse": {
"type": "object",
"properties": {
@@ -11330,6 +11491,20 @@ const docTemplate = `{
}
}
},
"oci-portal_internal_service.CreatedApiKey": {
"type": "object",
"properties": {
"configIni": {
"type": "string"
},
"fingerprint": {
"type": "string"
},
"privateKey": {
"type": "string"
}
}
},
"oci-portal_internal_service.ImportFail": {
"type": "object",
"properties": {
@@ -11912,6 +12087,24 @@ const docTemplate = `{
"type": "string"
}
}
},
"oci-portal_internal_service.UserApiKeyInfo": {
"type": "object",
"properties": {
"configIni": {
"type": "string"
},
"fingerprint": {
"type": "string"
},
"isCurrent": {
"description": "IsCurrent 表示该 key 正被当前配置用于签名请求",
"type": "boolean"
},
"timeCreated": {
"type": "string"
}
}
}
},
"securityDefinitions": {
+193
View File
@@ -1565,6 +1565,43 @@
}
}
},
"/api/v1/oci-configs/{id}/activate-api-key": {
"post": {
"security": [
{
"BearerAuth": []
}
],
"description": "将刚创建的 key 设为本配置签名凭据:验证可用后落库,不删除旧 key;私钥为创建时下发的那份回传。",
"tags": [
"租户 IAM"
],
"summary": "启用 API Key 为面板签名凭据",
"parameters": [
{
"type": "integer",
"description": "配置 ID",
"name": "id",
"in": "path",
"required": true
},
{
"description": "请求体:fingerprint 与 privateKey",
"name": "body",
"in": "body",
"required": true,
"schema": {
"type": "object"
}
}
],
"responses": {
"204": {
"description": "无内容"
}
}
}
},
"/api/v1/oci-configs/{id}/audit-events": {
"get": {
"security": [
@@ -5788,6 +5825,77 @@
}
},
"/api/v1/oci-configs/{id}/users/{userId}/api-keys": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"tags": [
"租户 IAM"
],
"summary": "列出用户 API Key",
"parameters": [
{
"type": "integer",
"description": "配置 ID",
"name": "id",
"in": "path",
"required": true
},
{
"type": "string",
"description": "userId",
"name": "userId",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/internal_api.userApiKeysResponse"
}
}
}
},
"post": {
"security": [
{
"BearerAuth": []
}
],
"description": "后端生成 RSA-2048 密钥对并上传公钥;私钥仅本次响应返回,不落库。",
"tags": [
"租户 IAM"
],
"summary": "为用户新增 API Key",
"parameters": [
{
"type": "integer",
"description": "配置 ID",
"name": "id",
"in": "path",
"required": true
},
{
"type": "string",
"description": "userId",
"name": "userId",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/oci-portal_internal_service.CreatedApiKey"
}
}
}
},
"delete": {
"security": [
{
@@ -5824,6 +5932,48 @@
}
}
},
"/api/v1/oci-configs/{id}/users/{userId}/api-keys/{fingerprint}": {
"delete": {
"security": [
{
"BearerAuth": []
}
],
"description": "当前配置正在使用的 key 拒删(409),避免面板失联。",
"tags": [
"租户 IAM"
],
"summary": "删除用户单把 API Key",
"parameters": [
{
"type": "integer",
"description": "配置 ID",
"name": "id",
"in": "path",
"required": true
},
{
"type": "string",
"description": "userId",
"name": "userId",
"in": "path",
"required": true
},
{
"type": "string",
"description": "key 指纹",
"name": "fingerprint",
"in": "path",
"required": true
}
],
"responses": {
"204": {
"description": "无内容"
}
}
}
},
"/api/v1/oci-configs/{id}/users/{userId}/mfa-devices": {
"delete": {
"security": [
@@ -8605,6 +8755,17 @@
}
}
},
"internal_api.userApiKeysResponse": {
"type": "object",
"properties": {
"items": {
"type": "array",
"items": {
"$ref": "#/definitions/oci-portal_internal_service.UserApiKeyInfo"
}
}
}
},
"internal_api.webConsoleSessionResponse": {
"type": "object",
"properties": {
@@ -11323,6 +11484,20 @@
}
}
},
"oci-portal_internal_service.CreatedApiKey": {
"type": "object",
"properties": {
"configIni": {
"type": "string"
},
"fingerprint": {
"type": "string"
},
"privateKey": {
"type": "string"
}
}
},
"oci-portal_internal_service.ImportFail": {
"type": "object",
"properties": {
@@ -11905,6 +12080,24 @@
"type": "string"
}
}
},
"oci-portal_internal_service.UserApiKeyInfo": {
"type": "object",
"properties": {
"configIni": {
"type": "string"
},
"fingerprint": {
"type": "string"
},
"isCurrent": {
"description": "IsCurrent 表示该 key 正被当前配置用于签名请求",
"type": "boolean"
},
"timeCreated": {
"type": "string"
}
}
}
},
"securityDefinitions": {
+123
View File
@@ -820,6 +820,13 @@ definitions:
usedBy:
type: integer
type: object
internal_api.userApiKeysResponse:
properties:
items:
items:
$ref: '#/definitions/oci-portal_internal_service.UserApiKeyInfo'
type: array
type: object
internal_api.webConsoleSessionResponse:
properties:
sessionId:
@@ -2619,6 +2626,15 @@ definitions:
tenancyOcid:
type: string
type: object
oci-portal_internal_service.CreatedApiKey:
properties:
configIni:
type: string
fingerprint:
type: string
privateKey:
type: string
type: object
oci-portal_internal_service.ImportFail:
properties:
line:
@@ -3006,6 +3022,18 @@ definitions:
oidcIssuer:
type: string
type: object
oci-portal_internal_service.UserApiKeyInfo:
properties:
configIni:
type: string
fingerprint:
type: string
isCurrent:
description: IsCurrent 表示该 key 正被当前配置用于签名请求
type: boolean
timeCreated:
type: string
type: object
info:
contact: {}
description: '自托管 OCI 多租户管理面板 API。业务接口用 JWT(Bearer);AI 网关端点(/ai/v1/*)用独立网关密钥(Authorization:
@@ -3964,6 +3992,29 @@ paths:
summary: 更新租户配置
tags:
- 租户配置
/api/v1/oci-configs/{id}/activate-api-key:
post:
description: 将刚创建的 key 设为本配置签名凭据:验证可用后落库,不删除旧 key;私钥为创建时下发的那份回传。
parameters:
- description: 配置 ID
in: path
name: id
required: true
type: integer
- description: 请求体:fingerprint 与 privateKey
in: body
name: body
required: true
schema:
type: object
responses:
"204":
description: 无内容
security:
- BearerAuth: []
summary: 启用 API Key 为面板签名凭据
tags:
- 租户 IAM
/api/v1/oci-configs/{id}/audit-events:
get:
parameters:
@@ -6631,6 +6682,78 @@ paths:
summary: 清除用户全部 API Key
tags:
- 租户 IAM
get:
parameters:
- description: 配置 ID
in: path
name: id
required: true
type: integer
- description: userId
in: path
name: userId
required: true
type: string
responses:
"200":
description: OK
schema:
$ref: '#/definitions/internal_api.userApiKeysResponse'
security:
- BearerAuth: []
summary: 列出用户 API Key
tags:
- 租户 IAM
post:
description: 后端生成 RSA-2048 密钥对并上传公钥;私钥仅本次响应返回,不落库。
parameters:
- description: 配置 ID
in: path
name: id
required: true
type: integer
- description: userId
in: path
name: userId
required: true
type: string
responses:
"200":
description: OK
schema:
$ref: '#/definitions/oci-portal_internal_service.CreatedApiKey'
security:
- BearerAuth: []
summary: 为用户新增 API Key
tags:
- 租户 IAM
/api/v1/oci-configs/{id}/users/{userId}/api-keys/{fingerprint}:
delete:
description: 当前配置正在使用的 key 拒删(409),避免面板失联。
parameters:
- description: 配置 ID
in: path
name: id
required: true
type: integer
- description: userId
in: path
name: userId
required: true
type: string
- description: key 指纹
in: path
name: fingerprint
required: true
type: string
responses:
"204":
description: 无内容
security:
- BearerAuth: []
summary: 删除用户单把 API Key
tags:
- 租户 IAM
/api/v1/oci-configs/{id}/users/{userId}/mfa-devices:
delete:
parameters: