< prev index next >

src/java.base/share/classes/java/security/ProtectionDomain.java

Print this page




  42 import sun.security.provider.PolicyFile;
  43 import sun.security.util.Debug;
  44 import sun.security.util.FilePermCompat;
  45 import sun.security.util.SecurityConstants;
  46 
  47 /**
  48  * The ProtectionDomain class encapsulates the characteristics of a domain,
  49  * which encloses a set of classes whose instances are granted a set
  50  * of permissions when being executed on behalf of a given set of Principals.
  51  * <p>
  52  * A static set of permissions can be bound to a ProtectionDomain when it is
  53  * constructed; such permissions are granted to the domain regardless of the
  54  * Policy in force. However, to support dynamic security policies, a
  55  * ProtectionDomain can also be constructed such that it is dynamically
  56  * mapped to a set of permissions by the current Policy whenever a permission
  57  * is checked.
  58  *
  59  * @author Li Gong
  60  * @author Roland Schemers
  61  * @author Gary Ellison

  62  */
  63 
  64 public class ProtectionDomain {
  65 
  66     /**
  67      * If true, {@link #impliesWithAltFilePerm} will try to be compatible on
  68      * FilePermission checking even if a 3rd-party Policy implementation is set.
  69      */
  70     private static final boolean filePermCompatInPD =
  71             "true".equals(GetPropertyAction.privilegedGetProperty(
  72                 "jdk.security.filePermCompat"));
  73 
  74     private static class JavaSecurityAccessImpl implements JavaSecurityAccess {
  75 
  76         private JavaSecurityAccessImpl() {
  77         }
  78 
  79         @Override
  80         public <T> T doIntersectionPrivilege(
  81                 PrivilegedAction<T> action,




  42 import sun.security.provider.PolicyFile;
  43 import sun.security.util.Debug;
  44 import sun.security.util.FilePermCompat;
  45 import sun.security.util.SecurityConstants;
  46 
  47 /**
  48  * The ProtectionDomain class encapsulates the characteristics of a domain,
  49  * which encloses a set of classes whose instances are granted a set
  50  * of permissions when being executed on behalf of a given set of Principals.
  51  * <p>
  52  * A static set of permissions can be bound to a ProtectionDomain when it is
  53  * constructed; such permissions are granted to the domain regardless of the
  54  * Policy in force. However, to support dynamic security policies, a
  55  * ProtectionDomain can also be constructed such that it is dynamically
  56  * mapped to a set of permissions by the current Policy whenever a permission
  57  * is checked.
  58  *
  59  * @author Li Gong
  60  * @author Roland Schemers
  61  * @author Gary Ellison
  62  * @since 1.2
  63  */
  64 
  65 public class ProtectionDomain {
  66 
  67     /**
  68      * If true, {@link #impliesWithAltFilePerm} will try to be compatible on
  69      * FilePermission checking even if a 3rd-party Policy implementation is set.
  70      */
  71     private static final boolean filePermCompatInPD =
  72             "true".equals(GetPropertyAction.privilegedGetProperty(
  73                 "jdk.security.filePermCompat"));
  74 
  75     private static class JavaSecurityAccessImpl implements JavaSecurityAccess {
  76 
  77         private JavaSecurityAccessImpl() {
  78         }
  79 
  80         @Override
  81         public <T> T doIntersectionPrivilege(
  82                 PrivilegedAction<T> action,


< prev index next >