简体   繁体   English

Google Cloud Endpoints v2:针对在本地开发计算机上执行的App Engine应用程序的测试API密钥机制

[英]Google Cloud Endpoints v2: Testing API key mechanism for an app-engine app executed on the local development machine

I'm a beginner in context of google-cloud-endpoints and the associated product "google-cloud-app-engine". 我是google-cloud-endpoints和相关产品“ google-cloud-app-engine”的初学者。

I've created a simple google app angine project/application and created an API-Key by using the google cloud platform's console. 我已经创建了一个简单的Google应用程序angine项目/应用程序,并使用Google Cloud Platform的控制台创建了API-Key。

To my app-engine's endpoints API definition I've added the annotation " apiKeyRequired = AnnotationBoolean.TRUE " as stated in Add API restriction by adding an API key to your app engine application 在我的应用程序引擎的端点API定义中,我已经添加了注释“ apiKeyRequired = AnnotationBoolean.TRUE ”,如添加API限制中所述,方法是将API密钥添加到您的应用程序引擎应用程序

and my client application which uses the generated endpoints client API was also updated accordingly to send the generated API key for all API requests. 使用生成的终结点客户端API的客户端应用程序也进行了相应更新,以针对所有API请求发送生成的API密钥。

As I would like to test the "API-Key" mechanism locally on my development machine (using a local app-engine environment) before deploying the backend to the cloud, I would like to know, whether it is possible to test the "API-Key"-restrictions locally. 由于我想在将后端部署到云之前在开发计算机上本地测试“ API-Key”机制(使用本地应用程序引擎环境),因此我想知道是否可以测试“ API” -Key”-本地限制。 I mean, somehow the locally executed app-engine backend app has to be aware of the created API key. 我的意思是,以某种方式本地执行的应用程序引擎后端应用程序必须知道创建的API密钥。 Maybe there is a property which I have to provide to my app-engine backend application's POM.xml file...I don't know, whether the google app-engine SDK supports API keys for local testing in context of the "endpoints framework v2" actually. 也许有一个属性我必须提供给我的应用程序引擎后端应用程序的POM.xml文件...我不知道,谷歌应用程序引擎SDK是否支持在“端点框架”上下文中进行本地测试的API密钥v2”。 The newley introduced API Management Platform (API-Gateway) can maybe not be "simulated" locally...?! Newley引入的API管理平台(API-Gateway)可能无法在本地“模拟” ...?!

Thank you so far for your effort! 到目前为止,感谢您的努力!

API key restrictions should work locally. API密钥限制应在本地运行。 You just need to include GoogleAppEngineControlFilter in your web.xml . 您只需要在web.xml包含GoogleAppEngineControlFilter

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM