34 import sun.misc.JavaSecurityProtectionDomainAccess; |
34 import sun.misc.JavaSecurityProtectionDomainAccess; |
35 import static sun.misc.JavaSecurityProtectionDomainAccess.ProtectionDomainCache; |
35 import static sun.misc.JavaSecurityProtectionDomainAccess.ProtectionDomainCache; |
36 import sun.misc.SharedSecrets; |
36 import sun.misc.SharedSecrets; |
37 import sun.security.util.Debug; |
37 import sun.security.util.Debug; |
38 import sun.security.util.SecurityConstants; |
38 import sun.security.util.SecurityConstants; |
|
39 import sun.misc.JavaSecurityAccess; |
|
40 import sun.misc.SharedSecrets; |
39 |
41 |
40 /** |
42 /** |
41 * |
43 * |
42 *<p> |
44 *<p> |
43 * This ProtectionDomain class encapsulates the characteristics of a domain, |
45 * This ProtectionDomain class encapsulates the characteristics of a domain, |
56 * @author Roland Schemers |
58 * @author Roland Schemers |
57 * @author Gary Ellison |
59 * @author Gary Ellison |
58 */ |
60 */ |
59 |
61 |
60 public class ProtectionDomain { |
62 public class ProtectionDomain { |
|
63 |
|
64 static { |
|
65 // Set up JavaSecurityAccess in SharedSecrets |
|
66 SharedSecrets.setJavaSecurityAccess( |
|
67 new JavaSecurityAccess() { |
|
68 public <T> T doIntersectionPrivilege( |
|
69 PrivilegedAction<T> action, |
|
70 final AccessControlContext stack, |
|
71 final AccessControlContext context) |
|
72 { |
|
73 if (action == null) { |
|
74 throw new NullPointerException(); |
|
75 } |
|
76 return AccessController.doPrivileged( |
|
77 action, |
|
78 new AccessControlContext( |
|
79 stack.getContext(), context).optimize() |
|
80 ); |
|
81 } |
|
82 |
|
83 public <T> T doIntersectionPrivilege( |
|
84 PrivilegedAction<T> action, |
|
85 AccessControlContext context) |
|
86 { |
|
87 return doIntersectionPrivilege(action, |
|
88 AccessController.getContext(), context); |
|
89 } |
|
90 } |
|
91 ); |
|
92 } |
61 |
93 |
62 /* CodeSource */ |
94 /* CodeSource */ |
63 private CodeSource codesource ; |
95 private CodeSource codesource ; |
64 |
96 |
65 /* ClassLoader the protection domain was consed from */ |
97 /* ClassLoader the protection domain was consed from */ |