From c8fced4cf16c5328f0f73dccad3bab0e95e52c5a Mon Sep 17 00:00:00 2001 From: RC-CHN <1051989940@qq.com> Date: Thu, 25 Dec 2025 11:26:56 +0800 Subject: [PATCH] fix(swagger): fix swagger authorization header --- cmd/server/main.go | 10 ++++------ docs/docs.go | 14 +------------- docs/swagger.json | 14 +------------- docs/swagger.yaml | 11 +---------- 4 files changed, 7 insertions(+), 42 deletions(-) diff --git a/cmd/server/main.go b/cmd/server/main.go index 6595949..4f1e61b 100644 --- a/cmd/server/main.go +++ b/cmd/server/main.go @@ -46,13 +46,11 @@ import ( // @host localhost:8080 // @BasePath / -// @securityDefinitions.apikey AdminAuth -// @in header -// @name Authorization +// @securityDefinitions.bearer AdminAuth +// @description Admin token for management API access -// @securityDefinitions.apikey MasterAuth -// @in header -// @name Authorization +// @securityDefinitions.bearer MasterAuth +// @description Master key for tenant API access func fatal(logger *slog.Logger, msg string, args ...any) { logger.Error(msg, args...) diff --git a/docs/docs.go b/docs/docs.go index b3b5786..15a34e1 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -4714,18 +4714,6 @@ const docTemplate = `{ } } } - }, - "securityDefinitions": { - "AdminAuth": { - "type": "apiKey", - "name": "Authorization", - "in": "header" - }, - "MasterAuth": { - "type": "apiKey", - "name": "Authorization", - "in": "header" - } } }` @@ -4736,7 +4724,7 @@ var SwaggerInfo = &swag.Spec{ BasePath: "/", Schemes: []string{}, Title: "EZ-API Control Plane", - Description: "Management API for EZ-API Gateway system.", + Description: "Master key for tenant API access", InfoInstanceName: "swagger", SwaggerTemplate: docTemplate, LeftDelim: "{{", diff --git a/docs/swagger.json b/docs/swagger.json index 4c9c37b..34922e0 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -1,7 +1,7 @@ { "swagger": "2.0", "info": { - "description": "Management API for EZ-API Gateway system.", + "description": "Master key for tenant API access", "title": "EZ-API Control Plane", "termsOfService": "http://swagger.io/terms/", "contact": { @@ -4708,17 +4708,5 @@ } } } - }, - "securityDefinitions": { - "AdminAuth": { - "type": "apiKey", - "name": "Authorization", - "in": "header" - }, - "MasterAuth": { - "type": "apiKey", - "name": "Authorization", - "in": "header" - } } } \ No newline at end of file diff --git a/docs/swagger.yaml b/docs/swagger.yaml index dbd1eff..74ef7ae 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -798,7 +798,7 @@ info: email: support@swagger.io name: API Support url: http://www.swagger.io/support - description: Management API for EZ-API Gateway system. + description: Master key for tenant API access license: name: Apache 2.0 url: http://www.apache.org/licenses/LICENSE-2.0.html @@ -3025,13 +3025,4 @@ paths: summary: Update child key tags: - master -securityDefinitions: - AdminAuth: - in: header - name: Authorization - type: apiKey - MasterAuth: - in: header - name: Authorization - type: apiKey swagger: "2.0"