简体   繁体   English

Java RMI:客户端安全策略

[英]Java RMI: Client security policy

grant {
    permission java.security.AllPermission;
};

This works.这有效。

grant file:///- {
    permission java.security.AllPermission;
};

This does not work.这不起作用。 Could someone please explain to me why?有人可以向我解释为什么吗?

The syntax should be:语法应该是:

grant codeBase "file:///-" { 
   ...
};

See the docs .请参阅文档 Note the semicolon.注意分号。

Be very careful assigning permissions to code.为代码分配权限要非常小心。

Are you sure the codebase should be a file URL (normal for development, not for production...).你确定代码库应该是一个文件 URL(对于开发来说是正常的,而不是用于生产......)。

The directive "grant { permission }" means grant the permission to all code no matter where it came from.指令“grant { permission }”表示授予所有代码的权限,无论它来自何处。 In other words, when there is no codebase specified, the code could be loaded from the network or the file system.换句话说,当没有指定代码库时,可以从网络或文件系统加载代码。

The second directive (if it worked) would only apply to the local file system.第二个指令(如果有效)仅适用于本地文件系统。 It would be specifying all files (recursively) on the local file system.它将指定本地文件系统上的所有文件(递归)。 I'm not sure that "file:///" is a valid URL by itself.我不确定“file:///”本身是否是一个有效的 URL。 I know that file:///tmp/- works.我知道file:///tmp/-有效。

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

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