为什么 Java Applet 不能仅请求特定权限(例如,录制音频)
我正在构建一个录音小程序,因此它需要录制声音的权限。我签署了 jar 文件,现在当我加载小程序时,会弹出一个对话框,显示:“来自本地主机的小程序正在请求访问您的计算机”,并提供“允许”或“拒绝”选项。如果我点击允许,它就可以录制声音。但令我失望的是,似乎没有办法让它只要求它需要的东西;像“这个小程序想要录制声音的权限。允许或拒绝”?有办法做到这一点吗?
如果没有,您知道用这个“全有或全无”对话框抛弃 Java 细粒度安全模型的理由吗?我可以看到用户允许站点录制一些声音,但不想授予其对硬盘驱动器的读/写访问权限。
I'm building an audio recording applet, so it needs permission to record sound. I signed the jar file, and now when I load the applet, a dialog pops up that says: "The applet from localhost is requesting access to your computer", and gives options for "Allow" or "Deny". If I click allow, it can record sound. But I'm disappointed that there seems to be no way to have it ask only for what it needs; something like "This applet would like permission to record sound. Allow or Deny"? Is there a way to do this?
If not, any idea on the rationale for throwing away Java's fine grained security model with this all-or-nothing dialog box? I could see a user allowing a site to record some sound, but not wanting to give it read/write access to the hard drive.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不。JRE 不向标准小程序提供如此细粒度的权限。
一个应用程序。使用 Java Web Start 启动可以访问本地文件系统、打印机和许多其他内容事情按照你建议的方式进行。但沙箱的“特定许可消息”放宽并不包括获取屏幕截图或捕获声音等内容。
No. The JRE does not offer such fine grained permissions to standard applets.
An app. launched using Java Web Start can get access to the local file system, the printer, and a number of other things in the way that you propose. But those 'specific permission message' relaxations of the sand-box do not include things like getting screen-shots or capturing sound.