Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
是否可以通过策略文件以外的方式授予权限?我想要实现的是一个可以在运行时修改的基于权限的系统。
您可以安装自己的安全管理器,
System.setSecurityManager(new YourSecurityManager());
在 YourSecurityManager 中,您可以从任何您喜欢的来源读取权限。
SecurityManager 用于整个 Java。您应该向默认管理器检查您不关心的权限。
性能也很关键。在 JRE 中经常检查 SecurityManager。如果实施不当,它可能会使您的系统慢下来。