RESTful API身份验证/安全性

时间:2012-09-27 15:42:22

标签: api google-app-engine authentication python-2.7 api-key

我正在GAE python上为我的应用程序开发一个RESTful API,现在我正试图找出保护这个API的最佳方法。 我在这个应用程序上有自己的成员/身份验证机制。

这样做的最佳方式是什么?

  • 拥有公钥/私钥对
  • 成为OAuth提供商
  • HTTP身份验证(对我来说似乎很弱)
  • 其他??

2 个答案:

答案 0 :(得分:2)

您可以使用Google服务帐户进行用户身份验证。但是,人们仍然可以注册帐户并使用您的API,您的应用引擎帐单肯定会上升。他们刚刚在Google I / O 2012上推出了Google Cloud Endpoints。您将拥有一个仅在您的客户端应用程序(Android,iOS)上使用的客户端ID。

Google I/O 2012 - Building Android Applications that Use Web APIs with Yaniv Inbar and Sriram Saroop

Google I/O 2012 - Building Mobile App Engine Backends for Android, iOS and the Web

如果您有兴趣,请尝试在

注册可信赖的测试人员

http://endpoints-trusted-tester.appspot.com/

答案 1 :(得分:2)

首先,丢弃HTTP身份验证。在真正的REST API中不建议使用它,因为它驻留在cookie上。

我会选择OAuth。有一个名为appengine_oauth_provider的库,它可以帮助您开始实现自己的提供程序。