該專案有兩個授權系統,基本認證和承載。在單擊“試用”和“執行”按鈕后,我需要為每個請求附加授權標頭,其中將有一個基本行和一個 jwt 標頭,其中將有一個不記名令牌。問題是我可以單獨附加這些標題,但不能一起附加。有一種感覺,兩個授權都想寫入 Authorization 標頭,其中一個覆寫另一個,即使我在架構中明確指出了標頭名稱。
我的模式:
{
"securitySchemes": {
"Bearer": {
"in": "header",
"name": "jwt",
"type": "http",
"scheme": "bearer"
},
"basicAuth": {
"type": "http",
"scheme": "basic"
}
}
}
以及我如何使用它:
{
"/channel/base-list": {
"get": {
"tags": [
"CMS Channel"
],
"security": [
{
"Bearer": [],
"basicAuth": []
}
],
"summary": "Get _id and title of all channels",
"produces": [
"application/json"
],
"parameters": [
{
"in": "query",
"name": "count",
"required": false,
"schema": {
"type": "Integer"
},
"default": 25,
"example": 10
},
{
"in": "query",
"name": "search",
"required": false,
"schema": {
"type": "String"
},
"description": "Channel name"
}
],
"responses": {
"200": {
"description": "A list of channels",
"content": {
"application/json": {
"schema": {
"$ref": "#/definitions/get-channel-base-list"
}
}
}
}
}
}
}
}
我對 node.JS 和 OpenAPI 3.0 使用 swagger-ui-express
uj5u.com熱心網友回復:
一個請求只能包含一個 Authorization標頭,并且Authorization標頭只能包含一組憑據(即 Basic 或 Bearer,但不能同時包含兩者)。HTTP 協議不支持您的用例。
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/459245.html
上一篇:節點分頁和過濾未按預期作業
