有没有正确的方法来操纵GoogleAppEngine安全权限? [英] Is there a right way to manipulate GoogleAppEngine security permissions?

查看:122
本文介绍了有没有正确的方法来操纵GoogleAppEngine安全权限?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个连接到另一个localhost服务器所需的GoogleAppEngine应用程序,但是当我尝试从服务器代码执行此操作时,我得到:

I have a GoogleAppEngine application that is required to connect to another localhost server, but when I'm trying to do this from the server code, I get:

java.security.AccessControlException:拒绝访问(java.net.SocketPermission localhost resolve)

我知道我可以使用java虚拟机参数指定我的附加安全授权(我在 Web应用程序运行配置中指定它们):

I know that I can specify my additional security grant by using java virtual machine arguments (I specify them in Web Application run configuration):

java -Djava.security.manager -Djava.security.policy = WEB-INF / java.policy

with java.policy contents:

with java.policy contents:

grant {
       permission java.net.SocketPermission "localhost:8081", "connect, resolve";
};

但它会覆盖位于私人类中的GoogleAppEngine内部安全管理器 com.google.appengine.tools.development.DevAppServerFactory $ CustomSecurityManager ,因此以这种方式禁用AppEngine本身所需的属性。

but it overrides the GoogleAppEngine internal security manager which is located in private class at com.google.appengine.tools.development.DevAppServerFactory$CustomSecurityManager, so the properties, required for AppEngine itself are disabled in that way.

有没有办法让GoogleAppEngine内部安全管理器类使用我的策略文件,而不是用jar中的stub(允许任何东西)文件手动替换它?

Is there any way to make GoogleAppEngine internal security manager class use my policy file instead of replacing it manually with a stub (allowing anything) file in a jar?

推荐答案

您无法在App Engine上打开套接字。您需要通过java.net或直接使用 URLFetch API 。但是,当您的应用程序上传到App Engine时,您希望如何访问localhost?

You can't open sockets on App Engine. You need to use the URLFetch API, either via java.net or directly. How do you expect to access 'localhost' when your app has been uploaded to App Engine, though?

这篇关于有没有正确的方法来操纵GoogleAppEngine安全权限?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆