author | coleenp |
Wed, 30 Aug 2017 19:18:22 -0400 | |
changeset 47098 | e704f55561c3 |
parent 29492 | a4bf9a570035 |
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) 1999, 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 java.security; |
|
27 |
||
28 |
/** |
|
18579
b678846778ad
8019360: Cleanup of the javadoc <code> tag in java.security.*
juh
parents:
5506
diff
changeset
|
29 |
* A {@code DomainCombiner} provides a means to dynamically |
2 | 30 |
* update the ProtectionDomains associated with the current |
18579
b678846778ad
8019360: Cleanup of the javadoc <code> tag in java.security.*
juh
parents:
5506
diff
changeset
|
31 |
* {@code AccessControlContext}. |
2 | 32 |
* |
18579
b678846778ad
8019360: Cleanup of the javadoc <code> tag in java.security.*
juh
parents:
5506
diff
changeset
|
33 |
* <p> A {@code DomainCombiner} is passed as a parameter to the |
b678846778ad
8019360: Cleanup of the javadoc <code> tag in java.security.*
juh
parents:
5506
diff
changeset
|
34 |
* appropriate constructor for {@code AccessControlContext}. |
2 | 35 |
* The newly constructed context is then passed to the |
18579
b678846778ad
8019360: Cleanup of the javadoc <code> tag in java.security.*
juh
parents:
5506
diff
changeset
|
36 |
* {@code AccessController.doPrivileged(..., context)} method |
b678846778ad
8019360: Cleanup of the javadoc <code> tag in java.security.*
juh
parents:
5506
diff
changeset
|
37 |
* to bind the provided context (and associated {@code DomainCombiner}) |
2 | 38 |
* with the current execution Thread. Subsequent calls to |
18579
b678846778ad
8019360: Cleanup of the javadoc <code> tag in java.security.*
juh
parents:
5506
diff
changeset
|
39 |
* {@code AccessController.getContext} or |
b678846778ad
8019360: Cleanup of the javadoc <code> tag in java.security.*
juh
parents:
5506
diff
changeset
|
40 |
* {@code AccessController.checkPermission} |
b678846778ad
8019360: Cleanup of the javadoc <code> tag in java.security.*
juh
parents:
5506
diff
changeset
|
41 |
* cause the {@code DomainCombiner.combine} to get invoked. |
2 | 42 |
* |
43 |
* <p> The combine method takes two arguments. The first argument represents |
|
44 |
* an array of ProtectionDomains from the current execution Thread, |
|
18579
b678846778ad
8019360: Cleanup of the javadoc <code> tag in java.security.*
juh
parents:
5506
diff
changeset
|
45 |
* since the most recent call to {@code AccessController.doPrivileged}. |
2 | 46 |
* If no call to doPrivileged was made, then the first argument will contain |
47 |
* all the ProtectionDomains from the current execution Thread. |
|
48 |
* The second argument represents an array of inherited ProtectionDomains, |
|
18579
b678846778ad
8019360: Cleanup of the javadoc <code> tag in java.security.*
juh
parents:
5506
diff
changeset
|
49 |
* which may be {@code null}. ProtectionDomains may be inherited |
2 | 50 |
* from a parent Thread, or from a privileged context. If no call to |
51 |
* doPrivileged was made, then the second argument will contain the |
|
52 |
* ProtectionDomains inherited from the parent Thread. If one or more calls |
|
53 |
* to doPrivileged were made, and the most recent call was to |
|
54 |
* doPrivileged(action, context), then the second argument will contain the |
|
55 |
* ProtectionDomains from the privileged context. If the most recent call |
|
56 |
* was to doPrivileged(action), then there is no privileged context, |
|
18579
b678846778ad
8019360: Cleanup of the javadoc <code> tag in java.security.*
juh
parents:
5506
diff
changeset
|
57 |
* and the second argument will be {@code null}. |
2 | 58 |
* |
18579
b678846778ad
8019360: Cleanup of the javadoc <code> tag in java.security.*
juh
parents:
5506
diff
changeset
|
59 |
* <p> The {@code combine} method investigates the two input arrays |
2 | 60 |
* of ProtectionDomains and returns a single array containing the updated |
18579
b678846778ad
8019360: Cleanup of the javadoc <code> tag in java.security.*
juh
parents:
5506
diff
changeset
|
61 |
* ProtectionDomains. In the simplest case, the {@code combine} |
2 | 62 |
* method merges the two stacks into one. In more complex cases, |
18579
b678846778ad
8019360: Cleanup of the javadoc <code> tag in java.security.*
juh
parents:
5506
diff
changeset
|
63 |
* the {@code combine} method returns a modified |
2 | 64 |
* stack of ProtectionDomains. The modification may have added new |
65 |
* ProtectionDomains, removed certain ProtectionDomains, or simply |
|
66 |
* updated existing ProtectionDomains. Re-ordering and other optimizations |
|
67 |
* to the ProtectionDomains are also permitted. Typically the |
|
18579
b678846778ad
8019360: Cleanup of the javadoc <code> tag in java.security.*
juh
parents:
5506
diff
changeset
|
68 |
* {@code combine} method bases its updates on the information |
b678846778ad
8019360: Cleanup of the javadoc <code> tag in java.security.*
juh
parents:
5506
diff
changeset
|
69 |
* encapsulated in the {@code DomainCombiner}. |
2 | 70 |
* |
18579
b678846778ad
8019360: Cleanup of the javadoc <code> tag in java.security.*
juh
parents:
5506
diff
changeset
|
71 |
* <p> After the {@code AccessController.getContext} method |
2 | 72 |
* receives the combined stack of ProtectionDomains back from |
18579
b678846778ad
8019360: Cleanup of the javadoc <code> tag in java.security.*
juh
parents:
5506
diff
changeset
|
73 |
* the {@code DomainCombiner}, it returns a new |
2 | 74 |
* AccessControlContext that has both the combined ProtectionDomains |
18579
b678846778ad
8019360: Cleanup of the javadoc <code> tag in java.security.*
juh
parents:
5506
diff
changeset
|
75 |
* as well as the {@code DomainCombiner}. |
2 | 76 |
* |
77 |
* @see AccessController |
|
78 |
* @see AccessControlContext |
|
79 |
* @since 1.3 |
|
80 |
*/ |
|
81 |
public interface DomainCombiner { |
|
82 |
||
83 |
/** |
|
84 |
* Modify or update the provided ProtectionDomains. |
|
85 |
* ProtectionDomains may be added to or removed from the given |
|
86 |
* ProtectionDomains. The ProtectionDomains may be re-ordered. |
|
87 |
* Individual ProtectionDomains may be modified (with a new |
|
88 |
* set of Permissions, for example). |
|
89 |
* |
|
90 |
* @param currentDomains the ProtectionDomains associated with the |
|
91 |
* current execution Thread, up to the most recent |
|
18579
b678846778ad
8019360: Cleanup of the javadoc <code> tag in java.security.*
juh
parents:
5506
diff
changeset
|
92 |
* privileged {@code ProtectionDomain}. |
28059
e576535359cc
8067377: My hobby: caning, then then canning, the the can-can
martin
parents:
25859
diff
changeset
|
93 |
* The ProtectionDomains are listed in order of execution, |
18579
b678846778ad
8019360: Cleanup of the javadoc <code> tag in java.security.*
juh
parents:
5506
diff
changeset
|
94 |
* with the most recently executing {@code ProtectionDomain} |
2 | 95 |
* residing at the beginning of the array. This parameter may |
18579
b678846778ad
8019360: Cleanup of the javadoc <code> tag in java.security.*
juh
parents:
5506
diff
changeset
|
96 |
* be {@code null} if the current execution Thread |
29492
a4bf9a570035
8028266: Tidy warnings cleanup for packages java.security/javax.security
avstepan
parents:
28059
diff
changeset
|
97 |
* has no associated ProtectionDomains. |
2 | 98 |
* |
99 |
* @param assignedDomains an array of inherited ProtectionDomains. |
|
100 |
* ProtectionDomains may be inherited from a parent Thread, |
|
18579
b678846778ad
8019360: Cleanup of the javadoc <code> tag in java.security.*
juh
parents:
5506
diff
changeset
|
101 |
* or from a privileged {@code AccessControlContext}. |
b678846778ad
8019360: Cleanup of the javadoc <code> tag in java.security.*
juh
parents:
5506
diff
changeset
|
102 |
* This parameter may be {@code null} |
2 | 103 |
* if there are no inherited ProtectionDomains. |
104 |
* |
|
105 |
* @return a new array consisting of the updated ProtectionDomains, |
|
18579
b678846778ad
8019360: Cleanup of the javadoc <code> tag in java.security.*
juh
parents:
5506
diff
changeset
|
106 |
* or {@code null}. |
2 | 107 |
*/ |
108 |
ProtectionDomain[] combine(ProtectionDomain[] currentDomains, |
|
109 |
ProtectionDomain[] assignedDomains); |
|
110 |
} |