1. /*
  2. * @(#)NetPermission.java 1.39 00/02/02
  3. *
  4. * Copyright 1997-2000 Sun Microsystems, Inc. All Rights Reserved.
  5. *
  6. * This software is the proprietary information of Sun Microsystems, Inc.
  7. * Use is subject to license terms.
  8. *
  9. */
  10. package java.net;
  11. import java.security.*;
  12. import java.util.Enumeration;
  13. import java.util.Hashtable;
  14. import java.util.StringTokenizer;
  15. /**
  16. * This class is for various network permissions.
  17. * A NetPermission contains a name (also referred to as a "target name") but
  18. * no actions list; you either have the named permission
  19. * or you don't.
  20. * <P>
  21. * The target name is the name of the network permission (see below). The naming
  22. * convention follows the hierarchical property naming convention.
  23. * Also, an asterisk
  24. * may appear at the end of the name, following a ".", or by itself, to
  25. * signify a wildcard match. For example: "foo.*" or "*" is valid,
  26. * "*foo" or "a*b" is not valid.
  27. * <P>
  28. * The following table lists all the possible NetPermission target names,
  29. * and for each provides a description of what the permission allows
  30. * and a discussion of the risks of granting code the permission.
  31. * <P>
  32. *
  33. * <table border=1 cellpadding=5>
  34. * <tr>
  35. * <th>Permission Target Name</th>
  36. * <th>What the Permission Allows</th>
  37. * <th>Risks of Allowing this Permission</th>
  38. * </tr>
  39. *
  40. * <tr>
  41. * <td>setDefaultAuthenticator</td>
  42. * <td>The ability to set the
  43. * way authentication information is retrieved when
  44. * a proxy or HTTP server asks for authentication</td>
  45. * <td>Malicious
  46. * code can set an authenticator that monitors and steals user
  47. * authentication input as it retrieves the input from the user.</td>
  48. * </tr>
  49. *
  50. * <tr>
  51. * <td>requestPasswordAuthentication</td>
  52. * <td>The ability
  53. * to ask the authenticator registered with the system for
  54. * a password</td>
  55. * <td>Malicious code may steal this password.</td>
  56. * </tr>
  57. *
  58. * <tr>
  59. * <td>specifyStreamHandler</td>
  60. * <td>The ability
  61. * to specify a stream handler when constructing a URL</td>
  62. * <td>Malicious code may create a URL with resources that it would
  63. normally not have access to (like file:/foo/fum/), specifying a
  64. stream handler that gets the actual bytes from someplace it does
  65. have access to. Thus it might be able to trick the system into
  66. creating a ProtectionDomain/CodeSource for a class even though
  67. that class really didn't come from that location.</td>
  68. * </tr>
  69. *
  70. * </table>
  71. *
  72. * @see java.security.BasicPermission
  73. * @see java.security.Permission
  74. * @see java.security.Permissions
  75. * @see java.security.PermissionCollection
  76. * @see java.lang.SecurityManager
  77. *
  78. * @version 1.39 00/02/02
  79. *
  80. * @author Marianne Mueller
  81. * @author Roland Schemers
  82. */
  83. public final class NetPermission extends BasicPermission {
  84. /**
  85. * Creates a new NetPermission with the specified name.
  86. * The name is the symbolic name of the NetPermission, such as
  87. * "setDefaultAuthenticator", etc. An asterisk
  88. * may appear at the end of the name, following a ".", or by itself, to
  89. * signify a wildcard match.
  90. *
  91. * @param name the name of the NetPermission.
  92. */
  93. public NetPermission(String name)
  94. {
  95. super(name);
  96. }
  97. /**
  98. * Creates a new NetPermission object with the specified name.
  99. * The name is the symbolic name of the NetPermission, and the
  100. * actions String is currently unused and should be null. This
  101. * constructor exists for use by the <code>Policy</code> object
  102. * to instantiate new Permission objects.
  103. *
  104. * @param name the name of the NetPermission.
  105. * @param actions should be null.
  106. */
  107. public NetPermission(String name, String actions)
  108. {
  109. super(name, actions);
  110. }
  111. }