Google app engine GCP:具有目标应用程序引擎HTTP的云计划程序作业。无法保护与管理员的连接
我已经创建了一个云调度程序作业,目标是应用程序引擎HTTP。目标URL是/admin/task/create documents 我有一个灵活运行Java8的应用程序引擎 它工作得很好,但现在我想确保云调度器作业(/admin/task/create documents)调用的servlet的访问权限仅限于GCP开发人员(通常称为“admin”)。我假设云调度器作业被认为是“admin” 选项1-不起作用 如前所述,我试图修改web.xml文件作为标准环境,但没有成功: web.xml文件:Google app engine GCP:具有目标应用程序引擎HTTP的云计划程序作业。无法保护与管理员的连接,google-app-engine,google-cloud-platform,google-cloud-scheduler,Google App Engine,Google Cloud Platform,Google Cloud Scheduler,我已经创建了一个云调度程序作业,目标是应用程序引擎HTTP。目标URL是/admin/task/create documents 我有一个灵活运行Java8的应用程序引擎 它工作得很好,但现在我想确保云调度器作业(/admin/task/create documents)调用的servlet的访问权限仅限于GCP开发人员(通常称为“admin”)。我假设云调度器作业被认为是“admin” 选项1-不起作用 如前所述,我试图修改web.xml文件作为标准环境,但没有成功: web.xml文件: &
<?xml version="1.0" encoding="utf-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
<security-constraint>
<web-resource-collection>
<web-resource-name>admin</web-resource-name>
<url-pattern>/admin/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>admin</role-name>
</auth-constraint>
</security-constraint>
</web-app>
但我也注意到,login参数已被弃用,如前所述和。他们提到了IAM策略,但我不确定应该如何配置它们
如何将云计划程序作业终结点仅保护为“admin”?您无法通过配置进行保护。您需要在代码中实现签入 您可以向URL添加静态值,如
https://my-url.appspot.com/admin/task/create-documents?key=my_secret
或使用云调度器的OIDC身份验证向端点提供JWT令牌
在这两种情况下,您都必须检查机密(JWT上的内容)是否是预期的机密
runtime: java
env: flex
threadsafe: true
runtime_config:
jdk: openjdk8
server: jetty9
handlers:
- url: /admin/.*
script: auto
login: admin
- url: /.*
script: auto
secure: always
env_variables:
JETTY_ARGS: -Djava.util.logging.config.file=WEB-INF/logging.properties
network:
instance_tag: no-ip
name: my-network
subnetwork_name: my-subnet