我对提供appengine服务器2服务器身份验证的新机制感到困惑。
我有2个应用程序。 App1和App2。 App1通过安全的restful接口与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/
它似乎仅适用于“google API”应用,而不适用于其他系统(即用户appengine应用)。
Q1。我是否可以使用AppIdentityService以安全的方式使用auth_contraint角色调用另一个appengine应用程序?
感谢任何帮助。
-lp
答案 0 :(得分:1)
您无法将应用程序标识添加到其他应用程序管理列表。 (您邀请的电子邮件必须接受邀请)。
您可以使用AppIdentityService使用应用程序的公钥/私钥来签署内容(由Google管理,包括密钥轮换),请参阅Asserting identity to other systems以及一些示例代码:Google App Engine Security Module API and JWT support
答案 1 :(得分: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:
....