Используя метод, упомянутый в - https://swagger.io/docs/specification/2-0/authentication/basic-authentication/
Я пытался с nodejs - swagger OAS2.0. и получаю эту ошибку -
{
"message": "unknown security handler: mySec",
"code": "server_error",
"statusCode": 403
}
Код, добавленный в swagger.yaml - -
securityDefinitions:
mySec:
type: basic
security:
- mySec: []
и определенные глобальные параметры ответа -
responses:
UnauthorizedError:
description: Authentication information is missing or invalid
headers:
WWW_Authenticate:
type: string
и вызов ответа выше в методе my / healthCheck get.
/healthcheck:
# binds a127 app logic to a route
x-swagger-router-controller: healthCheck
get:
description: Returns version of package.json
# used as the method name of the controller
operationId: healthCheckEndpoint
responses:
"200":
description: Success
schema:
# a pointer to a definition
$ref: "#/definitions/SearchReportResponse"
"401":
$ref: "#/responses/UnauthorizedError"