mirror of
https://github.com/EZ-Api/ez-api.git
synced 2026-01-13 17:47:51 +00:00
feat(api): add /auth/whoami endpoint and build automation
This commit is contained in:
111
docs/docs.go
111
docs/docs.go
@@ -2859,6 +2859,40 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"/auth/whoami": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"AdminAuth": []
|
||||
},
|
||||
{
|
||||
"MasterAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Returns the identity of the authenticated user based on the Authorization header.\nSupports Admin Token, Master Key, and Child Key (API Key) authentication.\n\nResponse varies by token type:\n- Admin Token: {\"type\": \"admin\", \"role\": \"admin\"}\n- Master Key: {\"type\": \"master\", \"id\": 1, \"name\": \"...\", ...}\n- Child Key: {\"type\": \"key\", \"id\": 5, \"master_id\": 1, \"issued_by\": \"master\", ...}",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"auth"
|
||||
],
|
||||
"summary": "Get current identity",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/internal_api.WhoamiResponse"
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Invalid or missing token",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/gin.H"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/internal/stats/flush": {
|
||||
"post": {
|
||||
"description": "Internal endpoint for flushing accumulated key usage stats from DP to CP database",
|
||||
@@ -4620,6 +4654,83 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"internal_api.WhoamiResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"created_at": {
|
||||
"type": "integer",
|
||||
"example": 1703505600
|
||||
},
|
||||
"default_namespace": {
|
||||
"type": "string",
|
||||
"example": "default"
|
||||
},
|
||||
"epoch": {
|
||||
"type": "integer",
|
||||
"example": 1
|
||||
},
|
||||
"global_qps": {
|
||||
"type": "integer",
|
||||
"example": 100
|
||||
},
|
||||
"group": {
|
||||
"type": "string",
|
||||
"example": "default"
|
||||
},
|
||||
"id": {
|
||||
"description": "Master fields (only present when type is \"master\")",
|
||||
"type": "integer",
|
||||
"example": 1
|
||||
},
|
||||
"issued_at_epoch": {
|
||||
"type": "integer",
|
||||
"example": 1
|
||||
},
|
||||
"issued_by": {
|
||||
"type": "string",
|
||||
"example": "master"
|
||||
},
|
||||
"master_id": {
|
||||
"description": "Key fields (only present when type is \"key\")",
|
||||
"type": "integer",
|
||||
"example": 1
|
||||
},
|
||||
"max_child_keys": {
|
||||
"type": "integer",
|
||||
"example": 5
|
||||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
"example": "tenant-a"
|
||||
},
|
||||
"namespaces": {
|
||||
"type": "string",
|
||||
"example": "default,ns1"
|
||||
},
|
||||
"role": {
|
||||
"description": "Admin fields (only present when type is \"admin\")",
|
||||
"type": "string",
|
||||
"example": "admin"
|
||||
},
|
||||
"scopes": {
|
||||
"type": "string",
|
||||
"example": "chat:write"
|
||||
},
|
||||
"status": {
|
||||
"type": "string",
|
||||
"example": "active"
|
||||
},
|
||||
"type": {
|
||||
"description": "Type of the authenticated identity: \"admin\", \"master\", or \"key\"",
|
||||
"type": "string",
|
||||
"example": "master"
|
||||
},
|
||||
"updated_at": {
|
||||
"type": "integer",
|
||||
"example": 1703505600
|
||||
}
|
||||
}
|
||||
},
|
||||
"internal_api.refreshModelRegistryRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
||||
Reference in New Issue
Block a user