1. /*
  2. * @(#)NetPermission.java 1.38 01/11/29
  3. *
  4. * Copyright 2002 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>
  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. * </table>
  68. *
  69. * @see java.security.BasicPermission
  70. * @see java.security.Permission
  71. * @see java.security.Permissions
  72. * @see java.security.PermissionCollection
  73. * @see java.lang.SecurityManager
  74. *
  75. * @version 1.38 01/11/29
  76. *
  77. * @author Marianne Mueller
  78. * @author Roland Schemers
  79. */
  80. public final class NetPermission extends BasicPermission {
  81. /**
  82. * Creates a new NetPermission with the specified name.
  83. * The name is the symbolic name of the NetPermission, such as
  84. * "setDefaultAuthenticator", etc. An asterisk
  85. * may appear at the end of the name, following a ".", or by itself, to
  86. * signify a wildcard match.
  87. *
  88. * @param name the name of the NetPermission.
  89. */
  90. public NetPermission(String name)
  91. {
  92. super(name);
  93. }
  94. /**
  95. * Creates a new NetPermission object with the specified name.
  96. * The name is the symbolic name of the NetPermission, and the
  97. * actions String is currently unused and should be null. This
  98. * constructor exists for use by the <code>Policy</code> object
  99. * to instantiate new Permission objects.
  100. *
  101. * @param name the name of the NetPermission.
  102. * @param actions should be null.
  103. */
  104. public NetPermission(String name, String actions)
  105. {
  106. super(name, actions);
  107. }
  108. }