2013-07-03 70 views
0

我很困惑与提供appengine服务器2服务器身份验证的新机制。AppIdentityService为appengine 2 appengine身份验证

我有2个应用程序。 App1和App2。 App1通过安全的宁静界面与App2进行交互。

App2接口使用admin角色保护在web.xml中。

<security-constraint> 
<web-resource-collection> 
<url-pattern>/V3/publish/*</url-pattern> 
</web-resource-collection> 
<auth-constraint> 
<role-name>admin</role-name> 
</auth-constraint> 
</security-constraint> 

我将App1应用程序标识添加到App2管理列表。

然后App1只是使用服务器应用程序标识调用接口。 根据下面的链接应用程序身份API应该帮助我在这里。

https://developers.google.com/appengine/docs/java/appidentity/

这似乎这个作品只为 “谷歌API” 的应用程序,而不是其他系统(ie.user的AppEngine应用程序)。

Q1。我可以使用AppIdentityService以auth_contraint角色以安全的方式调用另一个appengine应用程序吗?

任何帮助表示赞赏。

-lp

回答

0

也许'X-Appengine-Inbound-Appid'足够你。它在App Engine中设置为App Engine请求,并且不能在外部请求中设置。

我们使用这样的事情在Python:

app_id = self.request.headers.get('X-Appengine-Inbound-Appid', None) 
if app_id not in {'some', 'other'}: 
    logging.warn(u'Callback from strange caller: %s', app_id) 
    .... 
else: 
    ....