我使用Cloud的版本控制特性(即openapi.yaml )将两个版本的gcloud service-management deploy openapi_v1.yaml openapi_v2.yaml文件部署到Google。yaml文件的每个版本都包含一个与另一个版本不同的版本号和basepath,其中一个端点使用api密钥身份验证,以及api密钥身份验证标记的定义。在部署到Endpoint之后,配置显示了两个yaml文件,但是使用此配置将api部署到GAE只会打开更新版本的api密钥身份验证。
是否有人知道这是一个已知的bug,或者我还需要做一些其他的事情来启用所有版本的身份验证?
.yaml文件如下所示。除了版本和浴道之外,我用来测试的两个版本是相同的:
swagger: "2.0"
info:
description: "This API is used to connect 3rd-party ids to a common user identity"
version: "0.0.1"
title: "****"
host: "uie-dot-user-id-exchange.appspot.com"
basePath: "/v0"
...
- "https"
x-google-allow: all
paths:
...
/ids/search:
get:
operationId: "id_search"
produces:
- "application/json"
security:
- api_key: []
tags:
- "Ids"
summary: "Privileged endpoint. Provide any id (3rd party or otherwise) and get a hash of all ids associated with it."
parameters:
- in: "query"
name: "id_type"
description: "Type of id to search"
required: true
type: string
- in: "query"
name: "id_value"
description: "Value of id to search"
required: true
type: string
responses:
200:
description: "AssociatedIdsHash"
schema:
$ref: '#/definitions/AssociatedIdsHash'
400:
description: "Bad request. Requires both id_type and id_value query parameters."
401:
description: "Unauthorized. Please provide a valid api-key in the \"api-key\" header."
404:
description: "Not found - no entry found for key provided"
...
################ SECURITY DEFINITIONS ################
securityDefinitions:
# This section configures basic authentication with an API key.
api_key:
type: "apiKey"
name: "key"
in: "query"发布于 2017-09-06 23:41:40
我可以复制这个问题,它似乎是一个bug。
真正起作用的是为这两个版本在全局级别上添加API键限制,而不是在每个路径级别。也许这个解决方案对您的用例来说就足够了。
...
security:
- api_key: []
path:
...https://stackoverflow.com/questions/45961702
复制相似问题