author | martin |
Tue, 15 Sep 2015 21:56:04 -0700 | |
changeset 32649 | 2ee9017c7597 |
parent 29820 | 7a3f0268f55b |
child 38955 | 1dc95586a112 |
permissions | -rw-r--r-- |
2 | 1 |
/* |
29492
a4bf9a570035
8028266: Tidy warnings cleanup for packages java.security/javax.security
avstepan
parents:
28059
diff
changeset
|
2 |
* Copyright (c) 1998, 2015, 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 javax.security.auth; |
|
27 |
||
7291
9fefa2786251
6995424: Eliminate dependency to a deprecated API com.sun.security.auth.PolicyFile
mullan
parents:
7179
diff
changeset
|
28 |
import java.security.Security; |
22334 | 29 |
import java.security.AccessController; |
30 |
import java.security.PrivilegedAction; |
|
31 |
import java.security.PrivilegedExceptionAction; |
|
32 |
import java.util.Objects; |
|
7291
9fefa2786251
6995424: Eliminate dependency to a deprecated API com.sun.security.auth.PolicyFile
mullan
parents:
7179
diff
changeset
|
33 |
import sun.security.util.Debug; |
9fefa2786251
6995424: Eliminate dependency to a deprecated API com.sun.security.auth.PolicyFile
mullan
parents:
7179
diff
changeset
|
34 |
|
2 | 35 |
/** |
36 |
* <p> This is an abstract class for representing the system policy for |
|
37 |
* Subject-based authorization. A subclass implementation |
|
38 |
* of this class provides a means to specify a Subject-based |
|
18830 | 39 |
* access control {@code Policy}. |
2 | 40 |
* |
18830 | 41 |
* <p> A {@code Policy} object can be queried for the set of |
2 | 42 |
* Permissions granted to code running as a |
18830 | 43 |
* {@code Principal} in the following manner: |
2 | 44 |
* |
45 |
* <pre> |
|
46 |
* policy = Policy.getPolicy(); |
|
47 |
* PermissionCollection perms = policy.getPermissions(subject, |
|
48 |
* codeSource); |
|
49 |
* </pre> |
|
50 |
* |
|
18830 | 51 |
* The {@code Policy} object consults the local policy and returns |
52 |
* and appropriate {@code Permissions} object with the |
|
2 | 53 |
* Permissions granted to the Principals associated with the |
29492
a4bf9a570035
8028266: Tidy warnings cleanup for packages java.security/javax.security
avstepan
parents:
28059
diff
changeset
|
54 |
* provided {@code subject}, and granted to the code specified |
a4bf9a570035
8028266: Tidy warnings cleanup for packages java.security/javax.security
avstepan
parents:
28059
diff
changeset
|
55 |
* by the provided {@code codeSource}. |
2 | 56 |
* |
18830 | 57 |
* <p> A {@code Policy} contains the following information. |
2 | 58 |
* Note that this example only represents the syntax for the default |
18830 | 59 |
* {@code Policy} implementation. Subclass implementations of this class |
2 | 60 |
* may implement alternative syntaxes and may retrieve the |
18830 | 61 |
* {@code Policy} from any source such as files, databases, |
2 | 62 |
* or servers. |
63 |
* |
|
18830 | 64 |
* <p> Each entry in the {@code Policy} is represented as |
2 | 65 |
* a <b><i>grant</i></b> entry. Each <b><i>grant</i></b> entry |
66 |
* specifies a codebase, code signers, and Principals triplet, |
|
67 |
* as well as the Permissions granted to that triplet. |
|
68 |
* |
|
69 |
* <pre> |
|
70 |
* grant CodeBase ["URL"], Signedby ["signers"], |
|
71 |
* Principal [Principal_Class] "Principal_Name" { |
|
72 |
* Permission Permission_Class ["Target_Name"] |
|
73 |
* [, "Permission_Actions"] |
|
74 |
* [, signedBy "SignerName"]; |
|
75 |
* }; |
|
76 |
* </pre> |
|
77 |
* |
|
78 |
* The CodeBase and Signedby components of the triplet name/value pairs |
|
28059
e576535359cc
8067377: My hobby: caning, then then canning, the the can-can
martin
parents:
25859
diff
changeset
|
79 |
* are optional. If they are not present, then any codebase will match, |
2 | 80 |
* and any signer (including unsigned code) will match. |
81 |
* For Example, |
|
82 |
* |
|
83 |
* <pre> |
|
84 |
* grant CodeBase "foo.com", Signedby "foo", |
|
85 |
* Principal com.sun.security.auth.SolarisPrincipal "duke" { |
|
86 |
* permission java.io.FilePermission "/home/duke", "read, write"; |
|
87 |
* }; |
|
88 |
* </pre> |
|
89 |
* |
|
90 |
* This <b><i>grant</i></b> entry specifies that code from "foo.com", |
|
18830 | 91 |
* signed by "foo', and running as a {@code SolarisPrincipal} with the |
92 |
* name, duke, has one {@code Permission}. This {@code Permission} |
|
2 | 93 |
* permits the executing code to read and write files in the directory, |
94 |
* "/home/duke". |
|
95 |
* |
|
18830 | 96 |
* <p> To "run" as a particular {@code Principal}, |
97 |
* code invokes the {@code Subject.doAs(subject, ...)} method. |
|
2 | 98 |
* After invoking that method, the code runs as all the Principals |
18830 | 99 |
* associated with the specified {@code Subject}. |
100 |
* Note that this {@code Policy} (and the Permissions |
|
101 |
* granted in this {@code Policy}) only become effective |
|
102 |
* after the call to {@code Subject.doAs} has occurred. |
|
2 | 103 |
* |
104 |
* <p> Multiple Principals may be listed within one <b><i>grant</i></b> entry. |
|
105 |
* All the Principals in the grant entry must be associated with |
|
18830 | 106 |
* the {@code Subject} provided to {@code Subject.doAs} |
107 |
* for that {@code Subject} to be granted the specified Permissions. |
|
2 | 108 |
* |
109 |
* <pre> |
|
110 |
* grant Principal com.sun.security.auth.SolarisPrincipal "duke", |
|
111 |
* Principal com.sun.security.auth.SolarisNumericUserPrincipal "0" { |
|
112 |
* permission java.io.FilePermission "/home/duke", "read, write"; |
|
113 |
* permission java.net.SocketPermission "duke.com", "connect"; |
|
114 |
* }; |
|
115 |
* </pre> |
|
116 |
* |
|
117 |
* This entry grants any code running as both "duke" and "0" |
|
118 |
* permission to read and write files in duke's home directory, |
|
119 |
* as well as permission to make socket connections to "duke.com". |
|
120 |
* |
|
121 |
* <p> Note that non Principal-based grant entries are not permitted |
|
18830 | 122 |
* in this {@code Policy}. Therefore, grant entries such as: |
2 | 123 |
* |
124 |
* <pre> |
|
125 |
* grant CodeBase "foo.com", Signedby "foo" { |
|
126 |
* permission java.io.FilePermission "/tmp/scratch", "read, write"; |
|
127 |
* }; |
|
128 |
* </pre> |
|
129 |
* |
|
130 |
* are rejected. Such permission must be listed in the |
|
18830 | 131 |
* {@code java.security.Policy}. |
2 | 132 |
* |
14775
2ed01c760aea
8004064: Downgrade normative references to ${java.home}/lib/security/java.security
mullan
parents:
7291
diff
changeset
|
133 |
* <p> The default {@code Policy} implementation can be changed by |
2ed01c760aea
8004064: Downgrade normative references to ${java.home}/lib/security/java.security
mullan
parents:
7291
diff
changeset
|
134 |
* setting the value of the {@code auth.policy.provider} security property to |
2ed01c760aea
8004064: Downgrade normative references to ${java.home}/lib/security/java.security
mullan
parents:
7291
diff
changeset
|
135 |
* the fully qualified name of the desired {@code Policy} implementation class. |
2 | 136 |
* |
137 |
* @deprecated as of JDK version 1.4 -- Replaced by java.security.Policy. |
|
138 |
* java.security.Policy has a method: |
|
139 |
* <pre> |
|
140 |
* public PermissionCollection getPermissions |
|
141 |
* (java.security.ProtectionDomain pd) |
|
142 |
* |
|
143 |
* </pre> |
|
144 |
* and ProtectionDomain has a constructor: |
|
145 |
* <pre> |
|
146 |
* public ProtectionDomain |
|
147 |
* (CodeSource cs, |
|
148 |
* PermissionCollection permissions, |
|
149 |
* ClassLoader loader, |
|
150 |
* Principal[] principals) |
|
151 |
* </pre> |
|
152 |
* |
|
153 |
* These two APIs provide callers the means to query the |
|
154 |
* Policy for Principal-based Permission entries. |
|
155 |
* |
|
14775
2ed01c760aea
8004064: Downgrade normative references to ${java.home}/lib/security/java.security
mullan
parents:
7291
diff
changeset
|
156 |
* @see java.security.Security security properties |
2 | 157 |
*/ |
158 |
@Deprecated |
|
159 |
public abstract class Policy { |
|
160 |
||
161 |
private static Policy policy; |
|
32649
2ee9017c7597
8136583: Core libraries should use blessed modifier order
martin
parents:
29820
diff
changeset
|
162 |
private static final String AUTH_POLICY = |
19439
57876ed3c426
8016850: JCK javax.security.auth.Policy tests fail when run in Profiles mode
mullan
parents:
18830
diff
changeset
|
163 |
"sun.security.provider.AuthPolicyFile"; |
2 | 164 |
|
22334 | 165 |
private final java.security.AccessControlContext acc = |
166 |
java.security.AccessController.getContext(); |
|
167 |
||
19439
57876ed3c426
8016850: JCK javax.security.auth.Policy tests fail when run in Profiles mode
mullan
parents:
18830
diff
changeset
|
168 |
// true if a custom (not AUTH_POLICY) system-wide policy object is set |
7291
9fefa2786251
6995424: Eliminate dependency to a deprecated API com.sun.security.auth.PolicyFile
mullan
parents:
7179
diff
changeset
|
169 |
private static boolean isCustomPolicy; |
9fefa2786251
6995424: Eliminate dependency to a deprecated API com.sun.security.auth.PolicyFile
mullan
parents:
7179
diff
changeset
|
170 |
|
2 | 171 |
/** |
172 |
* Sole constructor. (For invocation by subclass constructors, typically |
|
173 |
* implicit.) |
|
174 |
*/ |
|
175 |
protected Policy() { } |
|
176 |
||
177 |
/** |
|
178 |
* Returns the installed Policy object. |
|
179 |
* This method first calls |
|
18830 | 180 |
* {@code SecurityManager.checkPermission} with the |
181 |
* {@code AuthPermission("getPolicy")} permission |
|
2 | 182 |
* to ensure the caller has permission to get the Policy object. |
183 |
* |
|
184 |
* @return the installed Policy. The return value cannot be |
|
18830 | 185 |
* {@code null}. |
2 | 186 |
* |
187 |
* @exception java.lang.SecurityException if the current thread does not |
|
188 |
* have permission to get the Policy object. |
|
189 |
* |
|
190 |
* @see #setPolicy |
|
191 |
*/ |
|
192 |
public static Policy getPolicy() { |
|
193 |
java.lang.SecurityManager sm = System.getSecurityManager(); |
|
194 |
if (sm != null) sm.checkPermission(new AuthPermission("getPolicy")); |
|
195 |
return getPolicyNoCheck(); |
|
196 |
} |
|
197 |
||
198 |
/** |
|
199 |
* Returns the installed Policy object, skipping the security check. |
|
200 |
* |
|
201 |
* @return the installed Policy. |
|
202 |
* |
|
203 |
*/ |
|
204 |
static Policy getPolicyNoCheck() { |
|
205 |
if (policy == null) { |
|
206 |
||
207 |
synchronized(Policy.class) { |
|
208 |
||
209 |
if (policy == null) { |
|
210 |
String policy_class = null; |
|
22334 | 211 |
policy_class = AccessController.doPrivileged |
212 |
(new PrivilegedAction<String>() { |
|
2 | 213 |
public String run() { |
214 |
return java.security.Security.getProperty |
|
215 |
("auth.policy.provider"); |
|
216 |
} |
|
217 |
}); |
|
218 |
if (policy_class == null) { |
|
19439
57876ed3c426
8016850: JCK javax.security.auth.Policy tests fail when run in Profiles mode
mullan
parents:
18830
diff
changeset
|
219 |
policy_class = AUTH_POLICY; |
2 | 220 |
} |
221 |
||
222 |
try { |
|
223 |
final String finalClass = policy_class; |
|
22334 | 224 |
|
225 |
Policy untrustedImpl = AccessController.doPrivileged( |
|
226 |
new PrivilegedExceptionAction<Policy>() { |
|
227 |
public Policy run() throws ClassNotFoundException, |
|
228 |
InstantiationException, |
|
229 |
IllegalAccessException { |
|
230 |
Class<? extends Policy> implClass = Class.forName( |
|
231 |
finalClass, false, |
|
232 |
Thread.currentThread().getContextClassLoader() |
|
233 |
).asSubclass(Policy.class); |
|
234 |
return implClass.newInstance(); |
|
235 |
} |
|
236 |
}); |
|
237 |
AccessController.doPrivileged( |
|
238 |
new PrivilegedExceptionAction<Void>() { |
|
239 |
public Void run() { |
|
240 |
setPolicy(untrustedImpl); |
|
241 |
isCustomPolicy = !finalClass.equals(AUTH_POLICY); |
|
242 |
return null; |
|
243 |
} |
|
244 |
}, Objects.requireNonNull(untrustedImpl.acc) |
|
245 |
); |
|
2 | 246 |
} catch (Exception e) { |
247 |
throw new SecurityException |
|
248 |
(sun.security.util.ResourcesMgr.getString |
|
7179
4afb81e50183
6987827: security/util/Resources.java needs improvement
weijun
parents:
5506
diff
changeset
|
249 |
("unable.to.instantiate.Subject.based.policy")); |
2 | 250 |
} |
251 |
} |
|
252 |
} |
|
253 |
} |
|
254 |
return policy; |
|
255 |
} |
|
256 |
||
257 |
||
258 |
/** |
|
259 |
* Sets the system-wide Policy object. This method first calls |
|
18830 | 260 |
* {@code SecurityManager.checkPermission} with the |
261 |
* {@code AuthPermission("setPolicy")} |
|
2 | 262 |
* permission to ensure the caller has permission to set the Policy. |
263 |
* |
|
264 |
* @param policy the new system Policy object. |
|
265 |
* |
|
266 |
* @exception java.lang.SecurityException if the current thread does not |
|
267 |
* have permission to set the Policy. |
|
268 |
* |
|
269 |
* @see #getPolicy |
|
270 |
*/ |
|
271 |
public static void setPolicy(Policy policy) { |
|
272 |
java.lang.SecurityManager sm = System.getSecurityManager(); |
|
273 |
if (sm != null) sm.checkPermission(new AuthPermission("setPolicy")); |
|
274 |
Policy.policy = policy; |
|
7291
9fefa2786251
6995424: Eliminate dependency to a deprecated API com.sun.security.auth.PolicyFile
mullan
parents:
7179
diff
changeset
|
275 |
// all non-null policy objects are assumed to be custom |
9fefa2786251
6995424: Eliminate dependency to a deprecated API com.sun.security.auth.PolicyFile
mullan
parents:
7179
diff
changeset
|
276 |
isCustomPolicy = policy != null ? true : false; |
9fefa2786251
6995424: Eliminate dependency to a deprecated API com.sun.security.auth.PolicyFile
mullan
parents:
7179
diff
changeset
|
277 |
} |
9fefa2786251
6995424: Eliminate dependency to a deprecated API com.sun.security.auth.PolicyFile
mullan
parents:
7179
diff
changeset
|
278 |
|
9fefa2786251
6995424: Eliminate dependency to a deprecated API com.sun.security.auth.PolicyFile
mullan
parents:
7179
diff
changeset
|
279 |
/** |
19439
57876ed3c426
8016850: JCK javax.security.auth.Policy tests fail when run in Profiles mode
mullan
parents:
18830
diff
changeset
|
280 |
* Returns true if a custom (not AUTH_POLICY) system-wide policy object |
57876ed3c426
8016850: JCK javax.security.auth.Policy tests fail when run in Profiles mode
mullan
parents:
18830
diff
changeset
|
281 |
* has been set or installed. This method is called by |
57876ed3c426
8016850: JCK javax.security.auth.Policy tests fail when run in Profiles mode
mullan
parents:
18830
diff
changeset
|
282 |
* SubjectDomainCombiner to provide backwards compatibility for |
7291
9fefa2786251
6995424: Eliminate dependency to a deprecated API com.sun.security.auth.PolicyFile
mullan
parents:
7179
diff
changeset
|
283 |
* developers that provide their own javax.security.auth.Policy |
9fefa2786251
6995424: Eliminate dependency to a deprecated API com.sun.security.auth.PolicyFile
mullan
parents:
7179
diff
changeset
|
284 |
* implementations. |
9fefa2786251
6995424: Eliminate dependency to a deprecated API com.sun.security.auth.PolicyFile
mullan
parents:
7179
diff
changeset
|
285 |
* |
19439
57876ed3c426
8016850: JCK javax.security.auth.Policy tests fail when run in Profiles mode
mullan
parents:
18830
diff
changeset
|
286 |
* @return true if a custom (not AUTH_POLICY) system-wide policy object |
57876ed3c426
8016850: JCK javax.security.auth.Policy tests fail when run in Profiles mode
mullan
parents:
18830
diff
changeset
|
287 |
* has been set; false otherwise |
7291
9fefa2786251
6995424: Eliminate dependency to a deprecated API com.sun.security.auth.PolicyFile
mullan
parents:
7179
diff
changeset
|
288 |
*/ |
9fefa2786251
6995424: Eliminate dependency to a deprecated API com.sun.security.auth.PolicyFile
mullan
parents:
7179
diff
changeset
|
289 |
static boolean isCustomPolicySet(Debug debug) { |
9fefa2786251
6995424: Eliminate dependency to a deprecated API com.sun.security.auth.PolicyFile
mullan
parents:
7179
diff
changeset
|
290 |
if (policy != null) { |
9fefa2786251
6995424: Eliminate dependency to a deprecated API com.sun.security.auth.PolicyFile
mullan
parents:
7179
diff
changeset
|
291 |
if (debug != null && isCustomPolicy) { |
9fefa2786251
6995424: Eliminate dependency to a deprecated API com.sun.security.auth.PolicyFile
mullan
parents:
7179
diff
changeset
|
292 |
debug.println("Providing backwards compatibility for " + |
9fefa2786251
6995424: Eliminate dependency to a deprecated API com.sun.security.auth.PolicyFile
mullan
parents:
7179
diff
changeset
|
293 |
"javax.security.auth.policy implementation: " + |
9fefa2786251
6995424: Eliminate dependency to a deprecated API com.sun.security.auth.PolicyFile
mullan
parents:
7179
diff
changeset
|
294 |
policy.toString()); |
9fefa2786251
6995424: Eliminate dependency to a deprecated API com.sun.security.auth.PolicyFile
mullan
parents:
7179
diff
changeset
|
295 |
} |
9fefa2786251
6995424: Eliminate dependency to a deprecated API com.sun.security.auth.PolicyFile
mullan
parents:
7179
diff
changeset
|
296 |
return isCustomPolicy; |
9fefa2786251
6995424: Eliminate dependency to a deprecated API com.sun.security.auth.PolicyFile
mullan
parents:
7179
diff
changeset
|
297 |
} |
9fefa2786251
6995424: Eliminate dependency to a deprecated API com.sun.security.auth.PolicyFile
mullan
parents:
7179
diff
changeset
|
298 |
// check if custom policy has been set using auth.policy.provider prop |
9fefa2786251
6995424: Eliminate dependency to a deprecated API com.sun.security.auth.PolicyFile
mullan
parents:
7179
diff
changeset
|
299 |
String policyClass = java.security.AccessController.doPrivileged |
9fefa2786251
6995424: Eliminate dependency to a deprecated API com.sun.security.auth.PolicyFile
mullan
parents:
7179
diff
changeset
|
300 |
(new java.security.PrivilegedAction<String>() { |
9fefa2786251
6995424: Eliminate dependency to a deprecated API com.sun.security.auth.PolicyFile
mullan
parents:
7179
diff
changeset
|
301 |
public String run() { |
9fefa2786251
6995424: Eliminate dependency to a deprecated API com.sun.security.auth.PolicyFile
mullan
parents:
7179
diff
changeset
|
302 |
return Security.getProperty("auth.policy.provider"); |
9fefa2786251
6995424: Eliminate dependency to a deprecated API com.sun.security.auth.PolicyFile
mullan
parents:
7179
diff
changeset
|
303 |
} |
9fefa2786251
6995424: Eliminate dependency to a deprecated API com.sun.security.auth.PolicyFile
mullan
parents:
7179
diff
changeset
|
304 |
}); |
19439
57876ed3c426
8016850: JCK javax.security.auth.Policy tests fail when run in Profiles mode
mullan
parents:
18830
diff
changeset
|
305 |
if (policyClass != null && !policyClass.equals(AUTH_POLICY)) { |
7291
9fefa2786251
6995424: Eliminate dependency to a deprecated API com.sun.security.auth.PolicyFile
mullan
parents:
7179
diff
changeset
|
306 |
if (debug != null) { |
9fefa2786251
6995424: Eliminate dependency to a deprecated API com.sun.security.auth.PolicyFile
mullan
parents:
7179
diff
changeset
|
307 |
debug.println("Providing backwards compatibility for " + |
9fefa2786251
6995424: Eliminate dependency to a deprecated API com.sun.security.auth.PolicyFile
mullan
parents:
7179
diff
changeset
|
308 |
"javax.security.auth.policy implementation: " + |
9fefa2786251
6995424: Eliminate dependency to a deprecated API com.sun.security.auth.PolicyFile
mullan
parents:
7179
diff
changeset
|
309 |
policyClass); |
9fefa2786251
6995424: Eliminate dependency to a deprecated API com.sun.security.auth.PolicyFile
mullan
parents:
7179
diff
changeset
|
310 |
} |
9fefa2786251
6995424: Eliminate dependency to a deprecated API com.sun.security.auth.PolicyFile
mullan
parents:
7179
diff
changeset
|
311 |
return true; |
9fefa2786251
6995424: Eliminate dependency to a deprecated API com.sun.security.auth.PolicyFile
mullan
parents:
7179
diff
changeset
|
312 |
} |
9fefa2786251
6995424: Eliminate dependency to a deprecated API com.sun.security.auth.PolicyFile
mullan
parents:
7179
diff
changeset
|
313 |
return false; |
2 | 314 |
} |
315 |
||
316 |
/** |
|
317 |
* Retrieve the Permissions granted to the Principals associated with |
|
18830 | 318 |
* the specified {@code CodeSource}. |
2 | 319 |
* |
18830 | 320 |
* @param subject the {@code Subject} |
2 | 321 |
* whose associated Principals, |
322 |
* in conjunction with the provided |
|
18830 | 323 |
* {@code CodeSource}, determines the Permissions |
2 | 324 |
* returned by this method. This parameter |
29820
7a3f0268f55b
8076223: Rest of tidy warning in javax.security / java.security
avstepan
parents:
29492
diff
changeset
|
325 |
* may be {@code null}. |
2 | 326 |
* |
18830 | 327 |
* @param cs the code specified by its {@code CodeSource} |
2 | 328 |
* that determines, in conjunction with the provided |
18830 | 329 |
* {@code Subject}, the Permissions |
2 | 330 |
* returned by this method. This parameter may be |
18830 | 331 |
* {@code null}. |
2 | 332 |
* |
333 |
* @return the Collection of Permissions granted to all the |
|
18830 | 334 |
* {@code Subject} and code specified in |
2 | 335 |
* the provided <i>subject</i> and <i>cs</i> |
336 |
* parameters. |
|
337 |
*/ |
|
338 |
public abstract java.security.PermissionCollection getPermissions |
|
339 |
(Subject subject, |
|
340 |
java.security.CodeSource cs); |
|
341 |
||
342 |
/** |
|
343 |
* Refresh and reload the Policy. |
|
344 |
* |
|
345 |
* <p>This method causes this object to refresh/reload its current |
|
346 |
* Policy. This is implementation-dependent. |
|
347 |
* For example, if the Policy object is stored in |
|
18830 | 348 |
* a file, calling {@code refresh} will cause the file to be re-read. |
2 | 349 |
* |
350 |
* @exception SecurityException if the caller does not have permission |
|
351 |
* to refresh the Policy. |
|
352 |
*/ |
|
353 |
public abstract void refresh(); |
|
354 |
} |