我的Cloud Run如何仅接受来自Cloud Scheduler和Google Directoy API的流量

问题描述

如何将Cloud Run设置为仅接受来自Cloud Scheduler和Directory API的请求?

我在Cloud Run上使用的烧瓶具有以下两个主要功能

  1. 将监视(HTTP)请求(由Cloud Scheduler触发)发送到google Directory API
  2. 从Google Directory API接收更新(HTTP请求)

当前,当为“ allUsers”授予“调用云运行”权限时,我在Cloud Run上的应用程序可以正常工作。

为了使其更加安全:

  1. 我从“云端运行”权限中删除了“ allUsers”
  2. 为Cloud Scheduler提供一个能够调用Cloud Run的服务帐户
  3. 将Directory API服务帐户添加到Cloud Run,并使其能够调用Cloud Run

Cloud Scheduler会毫无问题地调用Cloud Run,但是当从Directory API收到更新时,我会不断得到:The request was not authenticated. Either allow unauthenticated invocations or set the proper Authorization header. Read more at https://cloud.google.com/run/docs/securing/authenticating

我正在使用的目录api请求的文档:https://developers.google.com/admin-sdk/directory/v1/reference/users/watch

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)