author | michaelm |
Mon, 25 Mar 2019 17:15:27 +0000 | |
changeset 58610 | 94710bb2a5bb |
parent 49925 | 3deb300f0e55 |
permissions | -rw-r--r-- |
2 | 1 |
/* |
58610 | 2 |
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved. |
2 | 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 |
|
5506 | 7 |
* published by the Free Software Foundation. Oracle designates this |
2 | 8 |
* particular file as subject to the "Classpath" exception as provided |
5506 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
2 | 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 |
* |
|
5506 | 21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
22 |
* or visit www.oracle.com if you need additional information or have any |
|
23 |
* questions. |
|
2 | 24 |
*/ |
25 |
||
26 |
package sun.security.util; |
|
27 |
||
49925
3deb300f0e55
8202419: Avoid creating Permission constants early
redestad
parents:
47216
diff
changeset
|
28 |
import java.lang.reflect.ReflectPermission; |
2 | 29 |
import java.net.SocketPermission; |
30 |
import java.net.NetPermission; |
|
3956
2586d23078e4
6854954: Eliminate static dependency on java.awt.AWTPermission
alanb
parents:
2057
diff
changeset
|
31 |
import java.security.Permission; |
2 | 32 |
import java.security.SecurityPermission; |
33 |
import java.security.AllPermission; |
|
40416
5d91b2fd668c
8130181: Deprecate java.security.Provider(String, double, String), add Provider(Strin
valeriep
parents:
36511
diff
changeset
|
34 |
import sun.security.action.GetPropertyAction; |
2 | 35 |
|
36 |
/** |
|
37 |
* Permission constants and string constants used to create permissions |
|
38 |
* used throughout the JDK. |
|
39 |
*/ |
|
40 |
public final class SecurityConstants { |
|
41 |
// Cannot create one of these |
|
42 |
private SecurityConstants () { |
|
43 |
} |
|
44 |
||
45 |
// Commonly used string constants for permission actions used by |
|
46 |
// SecurityManager. Declare here for shortcut when checking permissions |
|
47 |
// in FilePermission, SocketPermission, and PropertyPermission. |
|
48 |
||
49 |
public static final String FILE_DELETE_ACTION = "delete"; |
|
50 |
public static final String FILE_EXECUTE_ACTION = "execute"; |
|
51 |
public static final String FILE_READ_ACTION = "read"; |
|
52 |
public static final String FILE_WRITE_ACTION = "write"; |
|
2057
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
2
diff
changeset
|
53 |
public static final String FILE_READLINK_ACTION = "readlink"; |
2 | 54 |
|
55 |
public static final String SOCKET_RESOLVE_ACTION = "resolve"; |
|
56 |
public static final String SOCKET_CONNECT_ACTION = "connect"; |
|
57 |
public static final String SOCKET_LISTEN_ACTION = "listen"; |
|
58 |
public static final String SOCKET_ACCEPT_ACTION = "accept"; |
|
59 |
public static final String SOCKET_CONNECT_ACCEPT_ACTION = "connect,accept"; |
|
60 |
||
61 |
public static final String PROPERTY_RW_ACTION = "read,write"; |
|
62 |
public static final String PROPERTY_READ_ACTION = "read"; |
|
63 |
public static final String PROPERTY_WRITE_ACTION = "write"; |
|
64 |
||
65 |
// Permission constants used in the various checkPermission() calls in JDK. |
|
66 |
||
67 |
// java.lang.Class, java.lang.SecurityManager, java.lang.System, |
|
68 |
// java.net.URLConnection, java.security.AllPermission, java.security.Policy, |
|
69 |
// sun.security.provider.PolicyFile |
|
70 |
public static final AllPermission ALL_PERMISSION = new AllPermission(); |
|
71 |
||
72 |
// java.net.URL |
|
73 |
public static final NetPermission SPECIFY_HANDLER_PERMISSION = |
|
74 |
new NetPermission("specifyStreamHandler"); |
|
75 |
||
76 |
// java.net.ProxySelector |
|
77 |
public static final NetPermission SET_PROXYSELECTOR_PERMISSION = |
|
78 |
new NetPermission("setProxySelector"); |
|
79 |
||
80 |
// java.net.ProxySelector |
|
81 |
public static final NetPermission GET_PROXYSELECTOR_PERMISSION = |
|
82 |
new NetPermission("getProxySelector"); |
|
83 |
||
84 |
// java.net.CookieHandler |
|
85 |
public static final NetPermission SET_COOKIEHANDLER_PERMISSION = |
|
86 |
new NetPermission("setCookieHandler"); |
|
87 |
||
88 |
// java.net.CookieHandler |
|
89 |
public static final NetPermission GET_COOKIEHANDLER_PERMISSION = |
|
90 |
new NetPermission("getCookieHandler"); |
|
91 |
||
92 |
// java.net.ResponseCache |
|
93 |
public static final NetPermission SET_RESPONSECACHE_PERMISSION = |
|
94 |
new NetPermission("setResponseCache"); |
|
95 |
||
96 |
// java.net.ResponseCache |
|
97 |
public static final NetPermission GET_RESPONSECACHE_PERMISSION = |
|
98 |
new NetPermission("getResponseCache"); |
|
99 |
||
58610 | 100 |
// java.net.ServerSocket, java.net.Socket |
101 |
public static final NetPermission SET_SOCKETIMPL_PERMISSION = |
|
102 |
new NetPermission("setSocketImpl"); |
|
103 |
||
36511 | 104 |
// java.lang.SecurityManager, sun.applet.AppletPanel |
2 | 105 |
public static final RuntimePermission CREATE_CLASSLOADER_PERMISSION = |
106 |
new RuntimePermission("createClassLoader"); |
|
107 |
||
108 |
// java.lang.SecurityManager |
|
109 |
public static final RuntimePermission CHECK_MEMBER_ACCESS_PERMISSION = |
|
110 |
new RuntimePermission("accessDeclaredMembers"); |
|
111 |
||
112 |
// java.lang.SecurityManager, sun.applet.AppletSecurity |
|
113 |
public static final RuntimePermission MODIFY_THREAD_PERMISSION = |
|
114 |
new RuntimePermission("modifyThread"); |
|
115 |
||
116 |
// java.lang.SecurityManager, sun.applet.AppletSecurity |
|
117 |
public static final RuntimePermission MODIFY_THREADGROUP_PERMISSION = |
|
118 |
new RuntimePermission("modifyThreadGroup"); |
|
119 |
||
120 |
// java.lang.Class |
|
121 |
public static final RuntimePermission GET_PD_PERMISSION = |
|
122 |
new RuntimePermission("getProtectionDomain"); |
|
123 |
||
124 |
// java.lang.Class, java.lang.ClassLoader, java.lang.Thread |
|
125 |
public static final RuntimePermission GET_CLASSLOADER_PERMISSION = |
|
126 |
new RuntimePermission("getClassLoader"); |
|
127 |
||
128 |
// java.lang.Thread |
|
129 |
public static final RuntimePermission STOP_THREAD_PERMISSION = |
|
130 |
new RuntimePermission("stopThread"); |
|
131 |
||
132 |
// java.lang.Thread |
|
133 |
public static final RuntimePermission GET_STACK_TRACE_PERMISSION = |
|
134 |
new RuntimePermission("getStackTrace"); |
|
135 |
||
49925
3deb300f0e55
8202419: Avoid creating Permission constants early
redestad
parents:
47216
diff
changeset
|
136 |
// java.lang.Thread |
3deb300f0e55
8202419: Avoid creating Permission constants early
redestad
parents:
47216
diff
changeset
|
137 |
public static final RuntimePermission SUBCLASS_IMPLEMENTATION_PERMISSION = |
3deb300f0e55
8202419: Avoid creating Permission constants early
redestad
parents:
47216
diff
changeset
|
138 |
new RuntimePermission("enableContextClassLoaderOverride"); |
3deb300f0e55
8202419: Avoid creating Permission constants early
redestad
parents:
47216
diff
changeset
|
139 |
|
2 | 140 |
// java.security.AccessControlContext |
141 |
public static final SecurityPermission CREATE_ACC_PERMISSION = |
|
142 |
new SecurityPermission("createAccessControlContext"); |
|
143 |
||
144 |
// java.security.AccessControlContext |
|
145 |
public static final SecurityPermission GET_COMBINER_PERMISSION = |
|
146 |
new SecurityPermission("getDomainCombiner"); |
|
147 |
||
148 |
// java.security.Policy, java.security.ProtectionDomain |
|
149 |
public static final SecurityPermission GET_POLICY_PERMISSION = |
|
150 |
new SecurityPermission ("getPolicy"); |
|
151 |
||
152 |
// java.lang.SecurityManager |
|
153 |
public static final SocketPermission LOCAL_LISTEN_PERMISSION = |
|
22339 | 154 |
new SocketPermission("localhost:0", SOCKET_LISTEN_ACTION); |
40416
5d91b2fd668c
8130181: Deprecate java.security.Provider(String, double, String), add Provider(Strin
valeriep
parents:
36511
diff
changeset
|
155 |
|
5d91b2fd668c
8130181: Deprecate java.security.Provider(String, double, String), add Provider(Strin
valeriep
parents:
36511
diff
changeset
|
156 |
public static final String PROVIDER_VER = |
5d91b2fd668c
8130181: Deprecate java.security.Provider(String, double, String), add Provider(Strin
valeriep
parents:
36511
diff
changeset
|
157 |
GetPropertyAction.privilegedGetProperty("java.specification.version"); |
49925
3deb300f0e55
8202419: Avoid creating Permission constants early
redestad
parents:
47216
diff
changeset
|
158 |
|
3deb300f0e55
8202419: Avoid creating Permission constants early
redestad
parents:
47216
diff
changeset
|
159 |
// java.lang.reflect.AccessibleObject |
3deb300f0e55
8202419: Avoid creating Permission constants early
redestad
parents:
47216
diff
changeset
|
160 |
public static final ReflectPermission ACCESS_PERMISSION = |
3deb300f0e55
8202419: Avoid creating Permission constants early
redestad
parents:
47216
diff
changeset
|
161 |
new ReflectPermission("suppressAccessChecks"); |
3deb300f0e55
8202419: Avoid creating Permission constants early
redestad
parents:
47216
diff
changeset
|
162 |
|
3deb300f0e55
8202419: Avoid creating Permission constants early
redestad
parents:
47216
diff
changeset
|
163 |
// sun.reflect.ReflectionFactory |
3deb300f0e55
8202419: Avoid creating Permission constants early
redestad
parents:
47216
diff
changeset
|
164 |
public static final RuntimePermission REFLECTION_FACTORY_ACCESS_PERMISSION = |
3deb300f0e55
8202419: Avoid creating Permission constants early
redestad
parents:
47216
diff
changeset
|
165 |
new RuntimePermission("reflectionFactoryAccess"); |
3deb300f0e55
8202419: Avoid creating Permission constants early
redestad
parents:
47216
diff
changeset
|
166 |
|
2 | 167 |
} |