home *** CD-ROM | disk | FTP | other *** search
/ Apple Developer Connection Student Program / ADC Tools Sampler CD Disk 3 1999.iso / Metrowerks CodeWarrior / Java Support / Java_Source / Java2 / src / java / net / NetPermission.java < prev    next >
Encoding:
Java Source  |  1999-05-28  |  3.9 KB  |  124 lines  |  [TEXT/CWIE]

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