API网关直通连接
我们有多个API,每个API都有许多端点,这些API受OAuth的保护,因此需要一个令牌才能访问任何API。
我们最终将把这些大的API分解为微服务穿过令牌,使API可以对其进行处理。
我之前已经提到过“直接连接”,但我无法找到有关此的任何真实信息,因此实际上可能是不可能的。
我还知道,这种违背了OpenAPI规格应该使用的内容,但理想情况下是我们目前想要的:
paths:
/myapi/*:
get:
security:
- Bearer: []
summary: Pass calls to my-api
operationId: get
x-google-backend:
address: https://my-api-12345.run.app/
responses:
'200':
description: OK
我可以称呼https://gw-adsgae.gateway.dev。 /myapi/info
或https://gw-adsgae.gateway.dev/myapi/customer
,并且它将通过网关将载体令牌传递到云运行中的API实例无需实际指定网关的OpenAPI规范中的所有单个端点和单独的路径,以匹配网关后面API中的所有端点,
这是完全可能的吗?
有没有办法将令牌穿过网关,而无需网关试图使用令牌做任何事情?
We have multiple APIs with many endpoints in each one and these APIs are protected using oAuth so a token is required to access any of the APIs.
We will eventually break these large APIs into microservices but for now I need to try and add a Cloud Run instance to a GCP API Gateway that will basically just proxy any request through the gateway to the API backend allowing the API to function "normally" including passing through the token so that the API can process that itself.
I have heard a "straight through connection" mentioned before but I've not been able to find any real information about this so it may not actually be possible.
I also get that this kind of goes against what the OpenAPI spec is supposed to be used for but ideally something like the following is what we currently want:
paths:
/myapi/*:
get:
security:
- Bearer: []
summary: Pass calls to my-api
operationId: get
x-google-backend:
address: https://my-api-12345.run.app/
responses:
'200':
description: OK
so that I could call https://gw-adsgae.gateway.dev/myapi/info
or https://gw-adsgae.gateway.dev/myapi/customer
and that it would go through the gateway passing the bearer token to the API in the Cloud Run instance without having to actually specify all of the individual endpoints and separate paths in the OpenAPI spec for the Gateway to match all of the endpoints in the APIs behind the Gateway
Is this generic/wildcard path spec possible at all?
Is there a way to pass the token through the Gateway without the Gateway trying to do anything with the token?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论