Save This Page
Home » openjdk-7 » java » net » [javadoc | source]
    1   /*
    2    * Copyright 1997-2004 Sun Microsystems, Inc.  All Rights Reserved.
    3    * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    4    *
    5    * This code is free software; you can redistribute it and/or modify it
    6    * under the terms of the GNU General Public License version 2 only, as
    7    * published by the Free Software Foundation.  Sun designates this
    8    * particular file as subject to the "Classpath" exception as provided
    9    * by Sun in the LICENSE file that accompanied this code.
   10    *
   11    * This code is distributed in the hope that it will be useful, but WITHOUT
   12    * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   13    * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   14    * version 2 for more details (a copy is included in the LICENSE file that
   15    * accompanied this code).
   16    *
   17    * You should have received a copy of the GNU General Public License version
   18    * 2 along with this work; if not, write to the Free Software Foundation,
   19    * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   20    *
   21    * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
   22    * CA 95054 USA or visit www.sun.com if you need additional information or
   23    * have any questions.
   24    */
   25   
   26   package java.net;
   27   
   28   import java.security;
   29   import java.util.Enumeration;
   30   import java.util.Hashtable;
   31   import java.util.StringTokenizer;
   32   
   33   /**
   34    * This class is for various network permissions.
   35    * A NetPermission contains a name (also referred to as a "target name") but
   36    * no actions list; you either have the named permission
   37    * or you don't.
   38    * <P>
   39    * The target name is the name of the network permission (see below). The naming
   40    * convention follows the  hierarchical property naming convention.
   41    * Also, an asterisk
   42    * may appear at the end of the name, following a ".", or by itself, to
   43    * signify a wildcard match. For example: "foo.*" or "*" is valid,
   44    * "*foo" or "a*b" is not valid.
   45    * <P>
   46    * The following table lists all the possible NetPermission target names,
   47    * and for each provides a description of what the permission allows
   48    * and a discussion of the risks of granting code the permission.
   49    * <P>
   50    *
   51    * <table border=1 cellpadding=5 summary="Permission target name, what the permission allows, and associated risks">
   52    * <tr>
   53    * <th>Permission Target Name</th>
   54    * <th>What the Permission Allows</th>
   55    * <th>Risks of Allowing this Permission</th>
   56    * </tr>
   57    *
   58    * <tr>
   59    *   <td>setDefaultAuthenticator</td>
   60    *   <td>The ability to set the
   61    * way authentication information is retrieved when
   62    * a proxy or HTTP server asks for authentication</td>
   63    *   <td>Malicious
   64    * code can set an authenticator that monitors and steals user
   65    * authentication input as it retrieves the input from the user.</td>
   66    * </tr>
   67    *
   68    * <tr>
   69    *   <td>requestPasswordAuthentication</td>
   70    *   <td>The ability
   71    * to ask the authenticator registered with the system for
   72    * a password</td>
   73    *   <td>Malicious code may steal this password.</td>
   74    * </tr>
   75    *
   76    * <tr>
   77    *   <td>specifyStreamHandler</td>
   78    *   <td>The ability
   79    * to specify a stream handler when constructing a URL</td>
   80    *   <td>Malicious code may create a URL with resources that it would
   81   normally not have access to (like file:/foo/fum/), specifying a
   82   stream handler that gets the actual bytes from someplace it does
   83   have access to. Thus it might be able to trick the system into
   84   creating a ProtectionDomain/CodeSource for a class even though
   85   that class really didn't come from that location.</td>
   86    * </tr>
   87    *
   88    * <tr>
   89    *   <td>setProxySelector</td>
   90    *   <td>The ability to set the proxy selector used to make decisions
   91    *   on which proxies to use when making network connections.</td>
   92    *   <td>Malicious code can set a ProxySelector that directs network
   93    *   traffic to an arbitrary network host.</td>
   94    * </tr>
   95    *
   96    * <tr>
   97    *   <td>getProxySelector</td>
   98    *   <td>The ability to get the proxy selector used to make decisions
   99    *   on which proxies to use when making network connections.</td>
  100    *   <td>Malicious code can get a ProxySelector to discover proxy
  101    *   hosts and ports on internal networks, which could then become
  102    *   targets for attack.</td>
  103    * </tr>
  104    *
  105    * <tr>
  106    *   <td>setCookieHandler</td>
  107    *   <td>The ability to set the cookie handler that processes highly
  108    *   security sensitive cookie information for an Http session.</td>
  109    *   <td>Malicious code can set a cookie handler to obtain access to
  110    *   highly security sensitive cookie information. Some web servers
  111    *   use cookies to save user private information such as access
  112    *   control information, or to track user browsing habit.</td>
  113    *   </tr>
  114    *
  115    * <tr>
  116    *   <td>getCookieHandler</td>
  117    *   <td>The ability to get the cookie handler that processes highly
  118    *   security sensitive cookie information for an Http session.</td>
  119    *   <td>Malicious code can get a cookie handler to obtain access to
  120    *   highly security sensitive cookie information. Some web servers
  121    *   use cookies to save user private information such as access
  122    *   control information, or to track user browsing habit.</td>
  123    *   </tr>
  124    *
  125    * <tr>
  126    *   <td>setResponseCache</td>
  127    *   <td>The ability to set the response cache that provides access to
  128    *   a local response cache.</td>
  129    *   <td>Malicious code getting access to the local response cache
  130    *   could access security sensitive information, or create false
  131    *   entries in the response cache.</td>
  132    *   </tr>
  133    *
  134    * <tr>
  135    *   <td>getResponseCache</td>
  136    *   <td>The ability to get the response cache that provides
  137    *   access to a local response cache.</td>
  138    *   <td>Malicious code getting access to the local response cache
  139    *   could access security sensitive information.</td>
  140    *   </tr>
  141    *
  142    * </table>
  143    *
  144    * @see java.security.BasicPermission
  145    * @see java.security.Permission
  146    * @see java.security.Permissions
  147    * @see java.security.PermissionCollection
  148    * @see java.lang.SecurityManager
  149    *
  150    *
  151    * @author Marianne Mueller
  152    * @author Roland Schemers
  153    */
  154   
  155   public final class NetPermission extends BasicPermission {
  156       private static final long serialVersionUID = -8343910153355041693L;
  157   
  158       /**
  159        * Creates a new NetPermission with the specified name.
  160        * The name is the symbolic name of the NetPermission, such as
  161        * "setDefaultAuthenticator", etc. An asterisk
  162        * may appear at the end of the name, following a ".", or by itself, to
  163        * signify a wildcard match.
  164        *
  165        * @param name the name of the NetPermission.
  166        *
  167        * @throws NullPointerException if <code>name</code> is <code>null</code>.
  168        * @throws IllegalArgumentException if <code>name</code> is empty.
  169        */
  170   
  171       public NetPermission(String name)
  172       {
  173           super(name);
  174       }
  175   
  176       /**
  177        * Creates a new NetPermission object with the specified name.
  178        * The name is the symbolic name of the NetPermission, and the
  179        * actions String is currently unused and should be null.
  180        *
  181        * @param name the name of the NetPermission.
  182        * @param actions should be null.
  183        *
  184        * @throws NullPointerException if <code>name</code> is <code>null</code>.
  185        * @throws IllegalArgumentException if <code>name</code> is empty.
  186        */
  187   
  188       public NetPermission(String name, String actions)
  189       {
  190           super(name, actions);
  191       }
  192   }

Save This Page
Home » openjdk-7 » java » net » [javadoc | source]