1. /*
  2. * @(#)NetPermission.java 1.49 04/02/03
  3. *
  4. * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package java.net;
  8. import java.security.*;
  9. import java.util.Enumeration;
  10. import java.util.Hashtable;
  11. import java.util.StringTokenizer;
  12. /**
  13. * This class is for various network permissions.
  14. * A NetPermission contains a name (also referred to as a "target name") but
  15. * no actions list; you either have the named permission
  16. * or you don't.
  17. * <P>
  18. * The target name is the name of the network permission (see below). The naming
  19. * convention follows the hierarchical property naming convention.
  20. * Also, an asterisk
  21. * may appear at the end of the name, following a ".", or by itself, to
  22. * signify a wildcard match. For example: "foo.*" or "*" is valid,
  23. * "*foo" or "a*b" is not valid.
  24. * <P>
  25. * The following table lists all the possible NetPermission target names,
  26. * and for each provides a description of what the permission allows
  27. * and a discussion of the risks of granting code the permission.
  28. * <P>
  29. *
  30. * <table border=1 cellpadding=5 summary="Permission target name, what the permission allows, and associated risks">
  31. * <tr>
  32. * <th>Permission Target Name</th>
  33. * <th>What the Permission Allows</th>
  34. * <th>Risks of Allowing this Permission</th>
  35. * </tr>
  36. *
  37. * <tr>
  38. * <td>setDefaultAuthenticator</td>
  39. * <td>The ability to set the
  40. * way authentication information is retrieved when
  41. * a proxy or HTTP server asks for authentication</td>
  42. * <td>Malicious
  43. * code can set an authenticator that monitors and steals user
  44. * authentication input as it retrieves the input from the user.</td>
  45. * </tr>
  46. *
  47. * <tr>
  48. * <td>requestPasswordAuthentication</td>
  49. * <td>The ability
  50. * to ask the authenticator registered with the system for
  51. * a password</td>
  52. * <td>Malicious code may steal this password.</td>
  53. * </tr>
  54. *
  55. * <tr>
  56. * <td>specifyStreamHandler</td>
  57. * <td>The ability
  58. * to specify a stream handler when constructing a URL</td>
  59. * <td>Malicious code may create a URL with resources that it would
  60. normally not have access to (like file:/foo/fum/), specifying a
  61. stream handler that gets the actual bytes from someplace it does
  62. have access to. Thus it might be able to trick the system into
  63. creating a ProtectionDomain/CodeSource for a class even though
  64. that class really didn't come from that location.</td>
  65. * </tr>
  66. *
  67. * <tr>
  68. * <td>setProxySelector</td>
  69. * <td>The ability to set the proxy selector used to make decisions
  70. * on which proxies to use when making network connections.</td>
  71. * <td>Malicious code can set a ProxySelector that directs network
  72. * traffic to an arbitrary network host.</td>
  73. * </tr>
  74. *
  75. * <tr>
  76. * <td>getProxySelector</td>
  77. * <td>The ability to get the proxy selector used to make decisions
  78. * on which proxies to use when making network connections.</td>
  79. * <td>Malicious code can get a ProxySelector to discover proxy
  80. * hosts and ports on internal networks, which could then become
  81. * targets for attack.</td>
  82. * </tr>
  83. *
  84. * <tr>
  85. * <td>setCookieHandler</td>
  86. * <td>The ability to set the cookie handler that processes highly
  87. * security sensitive cookie information for an Http session.</td>
  88. * <td>Malicious code can set a cookie handler to obtain access to
  89. * highly security sensitive cookie information. Some web servers
  90. * use cookies to save user private information such as access
  91. * control information, or to track user browsing habit.</td>
  92. * </tr>
  93. *
  94. * <tr>
  95. * <td>getCookieHandler</td>
  96. * <td>The ability to get the cookie handler that processes highly
  97. * security sensitive cookie information for an Http session.</td>
  98. * <td>Malicious code can get a cookie handler to obtain access to
  99. * highly security sensitive cookie information. Some web servers
  100. * use cookies to save user private information such as access
  101. * control information, or to track user browsing habit.</td>
  102. * </tr>
  103. *
  104. * <tr>
  105. * <td>setResponseCache</td>
  106. * <td>The ability to set the response cache that provides access to
  107. * a local response cache.</td>
  108. * <td>Malicious code getting access to the local response cache
  109. * could access security sensitive information, or create false
  110. * entries in the response cache.</td>
  111. * </tr>
  112. *
  113. * <tr>
  114. * <td>getResponseCache</td>
  115. * <td>The ability to get the response cache that provides
  116. * access to a local response cache.</td>
  117. * <td>Malicious code getting access to the local response cache
  118. * could access security sensitive information.</td>
  119. * </tr>
  120. *
  121. * </table>
  122. *
  123. * @see java.security.BasicPermission
  124. * @see java.security.Permission
  125. * @see java.security.Permissions
  126. * @see java.security.PermissionCollection
  127. * @see java.lang.SecurityManager
  128. *
  129. * @version 1.49 04/02/03
  130. *
  131. * @author Marianne Mueller
  132. * @author Roland Schemers
  133. */
  134. public final class NetPermission extends BasicPermission {
  135. private static final long serialVersionUID = -8343910153355041693L;
  136. /**
  137. * Creates a new NetPermission with the specified name.
  138. * The name is the symbolic name of the NetPermission, such as
  139. * "setDefaultAuthenticator", etc. An asterisk
  140. * may appear at the end of the name, following a ".", or by itself, to
  141. * signify a wildcard match.
  142. *
  143. * @param name the name of the NetPermission.
  144. */
  145. public NetPermission(String name)
  146. {
  147. super(name);
  148. }
  149. /**
  150. * Creates a new NetPermission object with the specified name.
  151. * The name is the symbolic name of the NetPermission, and the
  152. * actions String is currently unused and should be null.
  153. *
  154. * @param name the name of the NetPermission.
  155. * @param actions should be null.
  156. */
  157. public NetPermission(String name, String actions)
  158. {
  159. super(name, actions);
  160. }
  161. }