使用安全管理器阻止公共方法访问
我曾经看到一篇文章说我们可以使用SecurityManager
来限制某些类调用另一个类的public
方法。我们该怎么做呢?
I had once come across a post that said that we can use the SecurityManager
to restrict certain classes from calling a public
method of another class. How do we do that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你至少可以链接到答案,然后更清楚地说出你不明白的地方。 所以,我将链接你看看我昨天对类似问题的回答。
如果还有不清楚的地方,请对此答案发表评论。
You could have at least linked to the answer, and then said more clearly, what you don't understand. So, I will link for you to my answer to a similar question from yesterday.
If something still is not clear, comment on this answer.
也许他们正在考虑对通过 package.access 安全属性加载的其他类加载的类隐藏包层次结构。请参阅安全编码指南的指南 1-1a Java 编程语言,版本 3.0。除此之外,如果一个类看不到 ClassLoader(无论如何!),那么它们将无法与该类加载器的类进行交互。
Perhaps they are thinking of hiding packages hierarchies from classes loaded by other class loaded through the
package.access
security property. See Guidelines 1-1a of the Secure Coding Guidelines for the Java Programming Language, Version 3.0. Other than that, if a class cannot see aClassLoader
(by any means!) then they will not be able to interact with classes of that class loader.