KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > java > net > NetPermission


1 /*
2  * @(#)NetPermission.java 1.51 06/04/21
3  *
4  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package java.net;
9
10 import java.security.*;
11 import java.util.Enumeration JavaDoc;
12 import java.util.Hashtable JavaDoc;
13 import java.util.StringTokenizer JavaDoc;
14
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 summary="Permission target name, what the permission allows, and associated risks">
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  * <tr>
71  * <td>setProxySelector</td>
72  * <td>The ability to set the proxy selector used to make decisions
73  * on which proxies to use when making network connections.</td>
74  * <td>Malicious code can set a ProxySelector that directs network
75  * traffic to an arbitrary network host.</td>
76  * </tr>
77  *
78  * <tr>
79  * <td>getProxySelector</td>
80  * <td>The ability to get the proxy selector used to make decisions
81  * on which proxies to use when making network connections.</td>
82  * <td>Malicious code can get a ProxySelector to discover proxy
83  * hosts and ports on internal networks, which could then become
84  * targets for attack.</td>
85  * </tr>
86  *
87  * <tr>
88  * <td>setCookieHandler</td>
89  * <td>The ability to set the cookie handler that processes highly
90  * security sensitive cookie information for an Http session.</td>
91  * <td>Malicious code can set a cookie handler to obtain access to
92  * highly security sensitive cookie information. Some web servers
93  * use cookies to save user private information such as access
94  * control information, or to track user browsing habit.</td>
95  * </tr>
96  *
97  * <tr>
98  * <td>getCookieHandler</td>
99  * <td>The ability to get the cookie handler that processes highly
100  * security sensitive cookie information for an Http session.</td>
101  * <td>Malicious code can get a cookie handler to obtain access to
102  * highly security sensitive cookie information. Some web servers
103  * use cookies to save user private information such as access
104  * control information, or to track user browsing habit.</td>
105  * </tr>
106  *
107  * <tr>
108  * <td>setResponseCache</td>
109  * <td>The ability to set the response cache that provides access to
110  * a local response cache.</td>
111  * <td>Malicious code getting access to the local response cache
112  * could access security sensitive information, or create false
113  * entries in the response cache.</td>
114  * </tr>
115  *
116  * <tr>
117  * <td>getResponseCache</td>
118  * <td>The ability to get the response cache that provides
119  * access to a local response cache.</td>
120  * <td>Malicious code getting access to the local response cache
121  * could access security sensitive information.</td>
122  * </tr>
123  *
124  * </table>
125  *
126  * @see java.security.BasicPermission
127  * @see java.security.Permission
128  * @see java.security.Permissions
129  * @see java.security.PermissionCollection
130  * @see java.lang.SecurityManager
131  *
132  * @version 1.51 06/04/21
133  *
134  * @author Marianne Mueller
135  * @author Roland Schemers
136  */

137
138 public final class NetPermission extends BasicPermission {
139     private static final long serialVersionUID = -8343910153355041693L;
140
141     /**
142      * Creates a new NetPermission with the specified name.
143      * The name is the symbolic name of the NetPermission, such as
144      * "setDefaultAuthenticator", etc. An asterisk
145      * may appear at the end of the name, following a ".", or by itself, to
146      * signify a wildcard match.
147      *
148      * @param name the name of the NetPermission.
149      *
150      * @throws NullPointerException if <code>name</code> is <code>null</code>.
151      * @throws IllegalArgumentException if <code>name</code> is empty.
152      */

153
154     public NetPermission(String JavaDoc name)
155     {
156     super(name);
157     }
158
159     /**
160      * Creates a new NetPermission object with the specified name.
161      * The name is the symbolic name of the NetPermission, and the
162      * actions String is currently unused and should be null.
163      *
164      * @param name the name of the NetPermission.
165      * @param actions should be null.
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 JavaDoc name, String JavaDoc actions)
172     {
173     super(name, actions);
174     }
175 }
176
Popular Tags