Documentation

The Java™ Tutorials
Hide TOC
Making Extensions Secure使扩展安全
Trail: The Extension Mechanism

Lesson: Making Extensions Secure教训:使扩展安全

Now that you have seen how to use extensions, you may be wondering what security privileges extensions have. 现在您已经了解了如何使用扩展,您可能想知道扩展有哪些安全特权。If you are developing an extension that does file I/O, for example, you will need to know how your extension is granted the appropriate permissions for reading and writing files. 例如,如果您正在开发一个执行文件I/O的扩展名,您需要知道如何授予扩展名读写文件的适当权限。Conversely, if you are thinking about using an extension developed by someone else, you will want to understand clearly what security privileges the extension has and how to change those privileges should you desire to do so.相反,如果您正在考虑使用由其他人开发的扩展,您将希望清楚地了解该扩展具有哪些安全特权,以及如果您希望更改这些特权,如何更改这些特权。

This lesson shows you how the Java™ platform's security architecture treats extensions. 此课程向您展示了Java™平台的安全架构处理扩展。You will see how to tell what privileges are granted to extension software, and you will learn how to modify extension privileges by following some simple steps. 您将看到如何判断授予扩展软件的权限,并将通过以下简单步骤了解如何修改扩展权限。In addition, you will learn how to seal packages within your extensions to restrict access to specified parts of your code.此外,您将学习如何在扩展中密封包,以限制对代码指定部分的访问。

This lesson has two sections:本课程分为两部分:

Setting Privileges for Extensions设置扩展权限

This section contains some examples that show you what conditions must be met for extensions to be granted permissions to perform security-sensitive operations.本节包含一些示例,这些示例向您展示了要授予扩展执行安全敏感操作的权限,必须满足哪些条件。

Sealing Packages in Extensions延长密封包装

You can optionally seal packages in extension JAR files as an additional security measure. 作为额外的安全措施,您可以选择在扩展JAR文件中密封包。If a package is sealed, it means that all classes defined in that package must originate from a single JAR file. 如果一个包是密封的,这意味着该包中定义的所有类都必须来自一个JAR文件。This section shows you how to modify an extension's manifest to seal extension packages.本节介绍如何修改扩展的清单以密封扩展包。

Additional Documentation附加文件

You will find links and references to relevant security documentation at appropriate places throughout this lesson.在本课程中,您将在适当的位置找到相关安全文档的链接和引用。

For complete information on security, you can refer to the following:有关安全性的完整信息,请参阅以下内容:


Previous page: Previous Lesson
Next page: Setting Privileges for Extensions