You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

permissions.html 7.2 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. <!DOCTYPE html>
  2. <!--
  3. Licensed to the Apache Software Foundation (ASF) under one or more
  4. contributor license agreements. See the NOTICE file distributed with
  5. this work for additional information regarding copyright ownership.
  6. The ASF licenses this file to You under the Apache License, Version 2.0
  7. (the "License"); you may not use this file except in compliance with
  8. the License. You may obtain a copy of the License at
  9. https://www.apache.org/licenses/LICENSE-2.0
  10. Unless required by applicable law or agreed to in writing, software
  11. distributed under the License is distributed on an "AS IS" BASIS,
  12. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. See the License for the specific language governing permissions and
  14. limitations under the License.
  15. -->
  16. <html lang="en">
  17. <head>
  18. <link rel="stylesheet" type="text/css" href="../stylesheets/style.css">
  19. <title>Permissions type</title>
  20. </head>
  21. <body>
  22. <h2 id="permissions">Permissions</h2>
  23. <p>Permissions represents a set of security permissions granted or revoked to a specific part
  24. code executed in the JVM where Apache Ant is running in. The actual Permissions are specified
  25. via a set of nested permission items either <code>&lt;grant&gt;</code>ed
  26. or <code>&lt;revoke&gt;</code>d.</p>
  27. <p>In the base situation a <a href="#baseset">base set</a> of permissions granted. Extra
  28. permissions can be granted. A granted permission can be overruled by revoking a permission. The
  29. security manager installed by the permissions will throw an <code>SecurityException</code> if
  30. the code subject to these permissions try to use an permission that has not been granted or that
  31. has been revoked.</p>
  32. <h3>Nested elements</h3>
  33. <h4>grant</h4>
  34. <p>Indicates a specific permission is always granted. Its attributes indicate which permissions
  35. are granted.</p>
  36. <table class="attr">
  37. <tr>
  38. <th scope="col">Attribute</th>
  39. <th scope="col">Description</th>
  40. <th scope="col">Required</th>
  41. </tr>
  42. <tr>
  43. <td>class</td>
  44. <td>The fully qualified name of the Permission class.</td>
  45. <td>Yes</td>
  46. </tr>
  47. <tr>
  48. <td>name</td>
  49. <td>The name of the Permission. The actual contents depends on the Permission class.</td>
  50. <td>No</td>
  51. </tr>
  52. <tr>
  53. <td>actions</td>
  54. <td>The actions allowed. The actual contents depend on the Permission class and name.</td>
  55. <td>No</td>
  56. </tr>
  57. </table>
  58. <p>Implied permissions are granted.</p>
  59. <p>Please note that some Permission classes may actually need a name and/or actions in order to
  60. function properly. The name and actions are parsed by the actual Permission class.</p>
  61. <h4>revoke</h4>
  62. <p>Indicates a specific permission is revoked.</p>
  63. <table class="attr">
  64. <tr>
  65. <th scope="col">Attribute</th>
  66. <th scope="col">Description</th>
  67. <th scope="col">Required</th>
  68. </tr>
  69. <tr>
  70. <td>class</td>
  71. <td>The fully qualified name of the Permission class.</td>
  72. <td>Yes</td>
  73. </tr>
  74. <tr>
  75. <td>name</td>
  76. <td>The name of the Permission. The actual contents depends on the Permission class.</td>
  77. <td>No</td>
  78. </tr>
  79. <tr>
  80. <td>actions</td>
  81. <td>The actions allowed. The actual contents depend on the Permission class and name.</td>
  82. <td>No</td>
  83. </tr>
  84. </table>
  85. <p>Implied permissions are not resolved and therefore also not revoked.</p>
  86. <p>The <var>name</var> can handle the <q>*</q> wildcard at the end of the name, in which case
  87. all permissions of the specified class of which the name starts with the specified name
  88. (excluding the <q>*</q>) are revoked. Note that the <q>-</q> wildcard often supported by the
  89. granted properties is not supported. If the <var>name</var> is left empty all names match, and
  90. are revoked. If the <var>actions</var> are left empty all actions match, and are revoked.</p>
  91. <h3 id="baseset">Base set</h3>
  92. <p>A permissions set implicitly contains the following permissions:</p>
  93. <pre>
  94. &lt;grant class=&quot;java.net.SocketPermission&quot; name=&quot;localhost:1024-&quot; actions=&quot;listen&quot;&gt;
  95. &lt;grant class=&quot;java.util.PropertyPermission&quot; name=&quot;java.version&quot; actions=&quot;read&quot;&gt;
  96. &lt;grant class=&quot;java.util.PropertyPermission&quot; name=&quot;java.vendor&quot; actions=&quot;read&quot;&gt;
  97. &lt;grant class=&quot;java.util.PropertyPermission&quot; name=&quot;java.vendor.url&quot; actions=&quot;read&quot;&gt;
  98. &lt;grant class=&quot;java.util.PropertyPermission&quot; name=&quot;java.class.version&quot; actions=&quot;read&quot;&gt;
  99. &lt;grant class=&quot;java.util.PropertyPermission&quot; name=&quot;os.name&quot; actions=&quot;read&quot;&gt;
  100. &lt;grant class=&quot;java.util.PropertyPermission&quot; name=&quot;os.version&quot; actions=&quot;read&quot;&gt;
  101. &lt;grant class=&quot;java.util.PropertyPermission&quot; name=&quot;os.arch&quot; actions=&quot;read&quot;&gt;
  102. &lt;grant class=&quot;java.util.PropertyPermission&quot; name=&quot;file.encoding&quot; actions=&quot;read&quot;&gt;
  103. &lt;grant class=&quot;java.util.PropertyPermission&quot; name=&quot;file.separator&quot; actions=&quot;read&quot;&gt;
  104. &lt;grant class=&quot;java.util.PropertyPermission&quot; name=&quot;path.separator&quot; actions=&quot;read&quot;&gt;
  105. &lt;grant class=&quot;java.util.PropertyPermission&quot; name=&quot;line.separator&quot; actions=&quot;read&quot;&gt;
  106. &lt;grant class=&quot;java.util.PropertyPermission&quot; name=&quot;java.specification.version&quot; actions=&quot;read&quot;&gt;
  107. &lt;grant class=&quot;java.util.PropertyPermission&quot; name=&quot;java.specification.vendor&quot; actions=&quot;read&quot;&gt;
  108. &lt;grant class=&quot;java.util.PropertyPermission&quot; name=&quot;java.specification.name&quot; actions=&quot;read&quot;&gt;
  109. &lt;grant class=&quot;java.util.PropertyPermission&quot; name=&quot;java.vm.specification.version&quot; actions=&quot;read&quot;&gt;
  110. &lt;grant class=&quot;java.util.PropertyPermission&quot; name=&quot;java.vm.specification.vendor&quot; actions=&quot;read&quot;&gt;
  111. &lt;grant class=&quot;java.util.PropertyPermission&quot; name=&quot;java.vm.specification.name&quot; actions=&quot;read&quot;&gt;
  112. &lt;grant class=&quot;java.util.PropertyPermission&quot; name=&quot;java.vm.version&quot; actions=&quot;read&quot;&gt;
  113. &lt;grant class=&quot;java.util.PropertyPermission&quot; name=&quot;java.vm.vendor&quot; actions=&quot;read&quot;&gt;
  114. &lt;grant class=&quot;java.util.PropertyPermission&quot; name=&quot;java.vm.name&quot; actions=&quot;read&quot;&gt;
  115. </pre>
  116. <p>These permissions can be revoked via <code>&lt;revoke&gt;</code> elements if necessary.</p>
  117. <h3>Examples</h3>
  118. <pre>
  119. &lt;permissions&gt;
  120. &lt;grant class=&quot;java.security.AllPermission&quot;/&gt;
  121. &lt;revoke class=&quot;java.util.PropertyPermission&quot;/&gt;
  122. &lt;/permissions&gt;
  123. </pre>
  124. <p>Grants all permissions to the code except for those handling Properties.</p>
  125. <pre>
  126. &lt;permissions&gt;
  127. &lt;grant class=&quot;java.net.SocketPermission&quot; name=&quot;foo.bar.com&quot; action=&quot;connect&quot;/&gt;
  128. &lt;grant class=&quot;java.util.PropertyPermission&quot; name=&quot;user.home&quot; action=&quot;read,write&quot;/&gt;
  129. &lt;/permissions&gt;
  130. </pre>
  131. <p>Grants the base set of permissions with the addition of
  132. a <code class="code">SocketPermission</code> to connect to <samp>foo.bar.com</samp> and the
  133. permission to read and write the <code>user.home</code> system property.</p>
  134. </body>
  135. </html>