src/java.base/share/classes/java/net/NetPermission.java
author chegar
Thu, 17 Oct 2019 20:53:35 +0100
branchdatagramsocketimpl-branch
changeset 58678 9cf78a70fa4f
parent 54158 5e1480a38a43
child 58679 9c3209ff7550
permissions -rw-r--r--
datagramsocketimpl-branch: update to default
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
58678
9cf78a70fa4f datagramsocketimpl-branch: update to default
chegar
parents: 54158
diff changeset
     2
 * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package java.net;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import java.security.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import java.util.Enumeration;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
import java.util.Hashtable;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
import java.util.StringTokenizer;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 * This class is for various network permissions.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 * A NetPermission contains a name (also referred to as a "target name") but
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 * no actions list; you either have the named permission
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * or you don't.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 * The target name is the name of the network permission (see below). The naming
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 * convention follows the  hierarchical property naming convention.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 * Also, an asterisk
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 * may appear at the end of the name, following a ".", or by itself, to
14667
6862285acf46 7167056: Clarify that BasicPermission names that contain non-wildcard asterisks are not invalid
mullan
parents: 9035
diff changeset
    43
 * signify a wildcard match. For example: "foo.*" and "*" signify a wildcard
6862285acf46 7167056: Clarify that BasicPermission names that contain non-wildcard asterisks are not invalid
mullan
parents: 9035
diff changeset
    44
 * match, while "*foo" and "a*b" do not.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 * <P>
54158
5e1480a38a43 8220719: Allow other named NetPermissions to be used
chegar
parents: 47216
diff changeset
    46
 * The following table lists the standard NetPermission target names,
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 * and for each provides a description of what the permission allows
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 * and a discussion of the risks of granting code the permission.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 *
45124
144479e89cdb 8179592: Update tables in java.base to be HTML 5-friendly.
jjg
parents: 26204
diff changeset
    50
 * <table class="striped">
144479e89cdb 8179592: Update tables in java.base to be HTML 5-friendly.
jjg
parents: 26204
diff changeset
    51
 * <caption style="display:none">Permission target name, what the permission allows, and associated risks</caption>
144479e89cdb 8179592: Update tables in java.base to be HTML 5-friendly.
jjg
parents: 26204
diff changeset
    52
 * <thead>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
 * <tr>
45881
aaec0fbe17ae 8184208: update class="striped" tables for accessibility
jjg
parents: 45434
diff changeset
    54
 * <th scope="col">Permission Target Name</th>
aaec0fbe17ae 8184208: update class="striped" tables for accessibility
jjg
parents: 45434
diff changeset
    55
 * <th scope="col">What the Permission Allows</th>
aaec0fbe17ae 8184208: update class="striped" tables for accessibility
jjg
parents: 45434
diff changeset
    56
 * <th scope="col">Risks of Allowing this Permission</th>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
 * </tr>
45124
144479e89cdb 8179592: Update tables in java.base to be HTML 5-friendly.
jjg
parents: 26204
diff changeset
    58
 * </thead>
144479e89cdb 8179592: Update tables in java.base to be HTML 5-friendly.
jjg
parents: 26204
diff changeset
    59
 * <tbody>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
 * <tr>
45881
aaec0fbe17ae 8184208: update class="striped" tables for accessibility
jjg
parents: 45434
diff changeset
    61
 *   <th scope="row">allowHttpTrace</th>
6875
81d6ec3397e5 6981426: limit use of TRACE method in HttpURLConnection
michaelm
parents: 5506
diff changeset
    62
 *   <td>The ability to use the HTTP TRACE method in HttpURLConnection.</td>
81d6ec3397e5 6981426: limit use of TRACE method in HttpURLConnection
michaelm
parents: 5506
diff changeset
    63
 *   <td>Malicious code using HTTP TRACE could get access to security sensitive
81d6ec3397e5 6981426: limit use of TRACE method in HttpURLConnection
michaelm
parents: 5506
diff changeset
    64
 *   information in the HTTP headers (such as cookies) that it might not
81d6ec3397e5 6981426: limit use of TRACE method in HttpURLConnection
michaelm
parents: 5506
diff changeset
    65
 *   otherwise have access to.</td>
81d6ec3397e5 6981426: limit use of TRACE method in HttpURLConnection
michaelm
parents: 5506
diff changeset
    66
 *   </tr>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
 * <tr>
45881
aaec0fbe17ae 8184208: update class="striped" tables for accessibility
jjg
parents: 45434
diff changeset
    69
 *   <th scope="row">getCookieHandler</th>
6875
81d6ec3397e5 6981426: limit use of TRACE method in HttpURLConnection
michaelm
parents: 5506
diff changeset
    70
 *   <td>The ability to get the cookie handler that processes highly
81d6ec3397e5 6981426: limit use of TRACE method in HttpURLConnection
michaelm
parents: 5506
diff changeset
    71
 *   security sensitive cookie information for an Http session.</td>
81d6ec3397e5 6981426: limit use of TRACE method in HttpURLConnection
michaelm
parents: 5506
diff changeset
    72
 *   <td>Malicious code can get a cookie handler to obtain access to
81d6ec3397e5 6981426: limit use of TRACE method in HttpURLConnection
michaelm
parents: 5506
diff changeset
    73
 *   highly security sensitive cookie information. Some web servers
81d6ec3397e5 6981426: limit use of TRACE method in HttpURLConnection
michaelm
parents: 5506
diff changeset
    74
 *   use cookies to save user private information such as access
81d6ec3397e5 6981426: limit use of TRACE method in HttpURLConnection
michaelm
parents: 5506
diff changeset
    75
 *   control information, or to track user browsing habit.</td>
81d6ec3397e5 6981426: limit use of TRACE method in HttpURLConnection
michaelm
parents: 5506
diff changeset
    76
 *   </tr>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
 * <tr>
45881
aaec0fbe17ae 8184208: update class="striped" tables for accessibility
jjg
parents: 45434
diff changeset
    79
 *   <th scope="row">getNetworkInformation</th>
26204
77df35747ce7 8055901: Update policytool for jdk.net.NetworkPermission
weijun
parents: 25859
diff changeset
    80
 *   <td>The ability to retrieve all information about local network interfaces.</td>
77df35747ce7 8055901: Update policytool for jdk.net.NetworkPermission
weijun
parents: 25859
diff changeset
    81
 *   <td>Malicious code can read information about network hardware such as
77df35747ce7 8055901: Update policytool for jdk.net.NetworkPermission
weijun
parents: 25859
diff changeset
    82
 *   MAC addresses, which could be used to construct local IPv6 addresses.</td>
8566
e2df5f8fa082 7024264: HttpURLConnection/NetPermission doc issue
michaelm
parents: 7668
diff changeset
    83
 * </tr>
e2df5f8fa082 7024264: HttpURLConnection/NetPermission doc issue
michaelm
parents: 7668
diff changeset
    84
 *
e2df5f8fa082 7024264: HttpURLConnection/NetPermission doc issue
michaelm
parents: 7668
diff changeset
    85
 * <tr>
45881
aaec0fbe17ae 8184208: update class="striped" tables for accessibility
jjg
parents: 45434
diff changeset
    86
 *   <th scope="row">getProxySelector</th>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
 *   <td>The ability to get the proxy selector used to make decisions
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
 *   on which proxies to use when making network connections.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
 *   <td>Malicious code can get a ProxySelector to discover proxy
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
 *   hosts and ports on internal networks, which could then become
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
 *   targets for attack.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
 * <tr>
45881
aaec0fbe17ae 8184208: update class="striped" tables for accessibility
jjg
parents: 45434
diff changeset
    95
 *   <th scope="row">getResponseCache</th>
6875
81d6ec3397e5 6981426: limit use of TRACE method in HttpURLConnection
michaelm
parents: 5506
diff changeset
    96
 *   <td>The ability to get the response cache that provides
81d6ec3397e5 6981426: limit use of TRACE method in HttpURLConnection
michaelm
parents: 5506
diff changeset
    97
 *   access to a local response cache.</td>
81d6ec3397e5 6981426: limit use of TRACE method in HttpURLConnection
michaelm
parents: 5506
diff changeset
    98
 *   <td>Malicious code getting access to the local response cache
81d6ec3397e5 6981426: limit use of TRACE method in HttpURLConnection
michaelm
parents: 5506
diff changeset
    99
 *   could access security sensitive information.</td>
81d6ec3397e5 6981426: limit use of TRACE method in HttpURLConnection
michaelm
parents: 5506
diff changeset
   100
 *   </tr>
81d6ec3397e5 6981426: limit use of TRACE method in HttpURLConnection
michaelm
parents: 5506
diff changeset
   101
 *
81d6ec3397e5 6981426: limit use of TRACE method in HttpURLConnection
michaelm
parents: 5506
diff changeset
   102
 * <tr>
45881
aaec0fbe17ae 8184208: update class="striped" tables for accessibility
jjg
parents: 45434
diff changeset
   103
 *   <th scope="row">requestPasswordAuthentication</th>
6875
81d6ec3397e5 6981426: limit use of TRACE method in HttpURLConnection
michaelm
parents: 5506
diff changeset
   104
 *   <td>The ability
26204
77df35747ce7 8055901: Update policytool for jdk.net.NetworkPermission
weijun
parents: 25859
diff changeset
   105
 *   to ask the authenticator registered with the system for
77df35747ce7 8055901: Update policytool for jdk.net.NetworkPermission
weijun
parents: 25859
diff changeset
   106
 *   a password</td>
6875
81d6ec3397e5 6981426: limit use of TRACE method in HttpURLConnection
michaelm
parents: 5506
diff changeset
   107
 *   <td>Malicious code may steal this password.</td>
81d6ec3397e5 6981426: limit use of TRACE method in HttpURLConnection
michaelm
parents: 5506
diff changeset
   108
 * </tr>
81d6ec3397e5 6981426: limit use of TRACE method in HttpURLConnection
michaelm
parents: 5506
diff changeset
   109
 *
81d6ec3397e5 6981426: limit use of TRACE method in HttpURLConnection
michaelm
parents: 5506
diff changeset
   110
 * <tr>
45881
aaec0fbe17ae 8184208: update class="striped" tables for accessibility
jjg
parents: 45434
diff changeset
   111
 *   <th scope="row">setCookieHandler</th>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
 *   <td>The ability to set the cookie handler that processes highly
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
 *   security sensitive cookie information for an Http session.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
 *   <td>Malicious code can set a cookie handler to obtain access to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
 *   highly security sensitive cookie information. Some web servers
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
 *   use cookies to save user private information such as access
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
 *   control information, or to track user browsing habit.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
 *   </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
 * <tr>
45881
aaec0fbe17ae 8184208: update class="striped" tables for accessibility
jjg
parents: 45434
diff changeset
   121
 *   <th scope="row">setDefaultAuthenticator</th>
6875
81d6ec3397e5 6981426: limit use of TRACE method in HttpURLConnection
michaelm
parents: 5506
diff changeset
   122
 *   <td>The ability to set the
26204
77df35747ce7 8055901: Update policytool for jdk.net.NetworkPermission
weijun
parents: 25859
diff changeset
   123
 *   way authentication information is retrieved when
77df35747ce7 8055901: Update policytool for jdk.net.NetworkPermission
weijun
parents: 25859
diff changeset
   124
 *   a proxy or HTTP server asks for authentication</td>
6875
81d6ec3397e5 6981426: limit use of TRACE method in HttpURLConnection
michaelm
parents: 5506
diff changeset
   125
 *   <td>Malicious
26204
77df35747ce7 8055901: Update policytool for jdk.net.NetworkPermission
weijun
parents: 25859
diff changeset
   126
 *   code can set an authenticator that monitors and steals user
77df35747ce7 8055901: Update policytool for jdk.net.NetworkPermission
weijun
parents: 25859
diff changeset
   127
 *   authentication input as it retrieves the input from the user.</td>
6875
81d6ec3397e5 6981426: limit use of TRACE method in HttpURLConnection
michaelm
parents: 5506
diff changeset
   128
 * </tr>
81d6ec3397e5 6981426: limit use of TRACE method in HttpURLConnection
michaelm
parents: 5506
diff changeset
   129
 *
81d6ec3397e5 6981426: limit use of TRACE method in HttpURLConnection
michaelm
parents: 5506
diff changeset
   130
 * <tr>
45881
aaec0fbe17ae 8184208: update class="striped" tables for accessibility
jjg
parents: 45434
diff changeset
   131
 *   <th scope="row">setProxySelector</th>
6875
81d6ec3397e5 6981426: limit use of TRACE method in HttpURLConnection
michaelm
parents: 5506
diff changeset
   132
 *   <td>The ability to set the proxy selector used to make decisions
81d6ec3397e5 6981426: limit use of TRACE method in HttpURLConnection
michaelm
parents: 5506
diff changeset
   133
 *   on which proxies to use when making network connections.</td>
81d6ec3397e5 6981426: limit use of TRACE method in HttpURLConnection
michaelm
parents: 5506
diff changeset
   134
 *   <td>Malicious code can set a ProxySelector that directs network
81d6ec3397e5 6981426: limit use of TRACE method in HttpURLConnection
michaelm
parents: 5506
diff changeset
   135
 *   traffic to an arbitrary network host.</td>
81d6ec3397e5 6981426: limit use of TRACE method in HttpURLConnection
michaelm
parents: 5506
diff changeset
   136
 * </tr>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
 * <tr>
45881
aaec0fbe17ae 8184208: update class="striped" tables for accessibility
jjg
parents: 45434
diff changeset
   139
 *   <th scope="row">setResponseCache</th>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
 *   <td>The ability to set the response cache that provides access to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
 *   a local response cache.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
 *   <td>Malicious code getting access to the local response cache
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
 *   could access security sensitive information, or create false
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
 *   entries in the response cache.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
 *   </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
 * <tr>
58678
9cf78a70fa4f datagramsocketimpl-branch: update to default
chegar
parents: 54158
diff changeset
   148
 *   <th scope="row">setSocketImpl</th>
9cf78a70fa4f datagramsocketimpl-branch: update to default
chegar
parents: 54158
diff changeset
   149
 *   <td>The ability to create a sub-class of Socket or ServerSocket with a
9cf78a70fa4f datagramsocketimpl-branch: update to default
chegar
parents: 54158
diff changeset
   150
 *   user specified SocketImpl.</td>
9cf78a70fa4f datagramsocketimpl-branch: update to default
chegar
parents: 54158
diff changeset
   151
 *   <td>Malicious user-defined SocketImpls can change the behavior of
9cf78a70fa4f datagramsocketimpl-branch: update to default
chegar
parents: 54158
diff changeset
   152
 *   Socket and ServerSocket in surprising ways, by virtue of their
9cf78a70fa4f datagramsocketimpl-branch: update to default
chegar
parents: 54158
diff changeset
   153
 *   ability to access the protected fields of SocketImpl.</td>
9cf78a70fa4f datagramsocketimpl-branch: update to default
chegar
parents: 54158
diff changeset
   154
 *   </tr>
9cf78a70fa4f datagramsocketimpl-branch: update to default
chegar
parents: 54158
diff changeset
   155
 *
9cf78a70fa4f datagramsocketimpl-branch: update to default
chegar
parents: 54158
diff changeset
   156
 * <tr>
45881
aaec0fbe17ae 8184208: update class="striped" tables for accessibility
jjg
parents: 45434
diff changeset
   157
 *   <th scope="row">specifyStreamHandler</th>
6875
81d6ec3397e5 6981426: limit use of TRACE method in HttpURLConnection
michaelm
parents: 5506
diff changeset
   158
 *   <td>The ability
26204
77df35747ce7 8055901: Update policytool for jdk.net.NetworkPermission
weijun
parents: 25859
diff changeset
   159
 *   to specify a stream handler when constructing a URL</td>
6875
81d6ec3397e5 6981426: limit use of TRACE method in HttpURLConnection
michaelm
parents: 5506
diff changeset
   160
 *   <td>Malicious code may create a URL with resources that it would
26204
77df35747ce7 8055901: Update policytool for jdk.net.NetworkPermission
weijun
parents: 25859
diff changeset
   161
 *   normally not have access to (like file:/foo/fum/), specifying a
77df35747ce7 8055901: Update policytool for jdk.net.NetworkPermission
weijun
parents: 25859
diff changeset
   162
 *   stream handler that gets the actual bytes from someplace it does
77df35747ce7 8055901: Update policytool for jdk.net.NetworkPermission
weijun
parents: 25859
diff changeset
   163
 *   have access to. Thus it might be able to trick the system into
77df35747ce7 8055901: Update policytool for jdk.net.NetworkPermission
weijun
parents: 25859
diff changeset
   164
 *   creating a ProtectionDomain/CodeSource for a class even though
77df35747ce7 8055901: Update policytool for jdk.net.NetworkPermission
weijun
parents: 25859
diff changeset
   165
 *   that class really didn't come from that location.</td>
6875
81d6ec3397e5 6981426: limit use of TRACE method in HttpURLConnection
michaelm
parents: 5506
diff changeset
   166
 * </tr>
45124
144479e89cdb 8179592: Update tables in java.base to be HTML 5-friendly.
jjg
parents: 26204
diff changeset
   167
   </tbody>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
 * </table>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
 *
54158
5e1480a38a43 8220719: Allow other named NetPermissions to be used
chegar
parents: 47216
diff changeset
   170
 * @implNote
5e1480a38a43 8220719: Allow other named NetPermissions to be used
chegar
parents: 47216
diff changeset
   171
 * Implementations may define additional target names, but should use naming
5e1480a38a43 8220719: Allow other named NetPermissions to be used
chegar
parents: 47216
diff changeset
   172
 * conventions such as reverse domain name notation to avoid name clashes.
5e1480a38a43 8220719: Allow other named NetPermissions to be used
chegar
parents: 47216
diff changeset
   173
 *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
 * @see java.security.BasicPermission
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
 * @see java.security.Permission
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
 * @see java.security.Permissions
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
 * @see java.security.PermissionCollection
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
 * @see java.lang.SecurityManager
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
 * @author Marianne Mueller
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
 * @author Roland Schemers
45434
4582657c7260 8181082: class-level since tag issues in java.base & java.datatransfer module
mli
parents: 45124
diff changeset
   183
 * @since 1.2
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
public final class NetPermission extends BasicPermission {
58678
9cf78a70fa4f datagramsocketimpl-branch: update to default
chegar
parents: 54158
diff changeset
   187
    @java.io.Serial
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
    private static final long serialVersionUID = -8343910153355041693L;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
     * Creates a new NetPermission with the specified name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
     * The name is the symbolic name of the NetPermission, such as
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
     * "setDefaultAuthenticator", etc. An asterisk
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
     * may appear at the end of the name, following a ".", or by itself, to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
     * signify a wildcard match.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
     * @param name the name of the NetPermission.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
     *
19069
1d9cb0d080e3 8021833: javadoc cleanup in java.net
juh
parents: 14667
diff changeset
   199
     * @throws NullPointerException if {@code name} is {@code null}.
1d9cb0d080e3 8021833: javadoc cleanup in java.net
juh
parents: 14667
diff changeset
   200
     * @throws IllegalArgumentException if {@code name} is empty.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
    public NetPermission(String name)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
        super(name);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
     * Creates a new NetPermission object with the specified name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
     * The name is the symbolic name of the NetPermission, and the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
     * actions String is currently unused and should be null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
     * @param name the name of the NetPermission.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
     * @param actions should be null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
     *
19069
1d9cb0d080e3 8021833: javadoc cleanup in java.net
juh
parents: 14667
diff changeset
   216
     * @throws NullPointerException if {@code name} is {@code null}.
1d9cb0d080e3 8021833: javadoc cleanup in java.net
juh
parents: 14667
diff changeset
   217
     * @throws IllegalArgumentException if {@code name} is empty.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
    public NetPermission(String name, String actions)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
        super(name, actions);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
}