< prev index next >

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

Print this page




  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package java.security;
  27 
  28 import java.util.Map;
  29 import java.util.Objects;
  30 import java.util.concurrent.ConcurrentHashMap;
  31 import java.util.function.Function;
  32 
  33 import sun.security.util.Debug;
  34 
  35 /**
  36  * This class extends ClassLoader with additional support for defining
  37  * classes with an associated code source and permissions which are
  38  * retrieved by the system policy by default.
  39  *
  40  * @author  Li Gong
  41  * @author  Roland Schemers

  42  */
  43 public class SecureClassLoader extends ClassLoader {
  44     /*
  45      * If initialization succeed this is set to true and security checks will
  46      * succeed. Otherwise the object is not initialized and the object is
  47      * useless.
  48      */
  49     private final boolean initialized;
  50 
  51     /*
  52      * Map that maps the CodeSource to a ProtectionDomain. The key is a
  53      * CodeSourceKey class that uses a String instead of a URL to avoid
  54      * potential expensive name service lookups. This does mean that URLs that
  55      * are equivalent after nameservice lookup will be placed in separate
  56      * ProtectionDomains; however during policy enforcement these URLs will be
  57      * canonicalized and resolved resulting in a consistent set of granted
  58      * permissions.
  59      */
  60     private final Map<CodeSourceKey, ProtectionDomain> pdcache
  61             = new ConcurrentHashMap<>(11);




  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package java.security;
  27 
  28 import java.util.Map;
  29 import java.util.Objects;
  30 import java.util.concurrent.ConcurrentHashMap;
  31 import java.util.function.Function;
  32 
  33 import sun.security.util.Debug;
  34 
  35 /**
  36  * This class extends ClassLoader with additional support for defining
  37  * classes with an associated code source and permissions which are
  38  * retrieved by the system policy by default.
  39  *
  40  * @author  Li Gong
  41  * @author  Roland Schemers
  42  * @since 1.2
  43  */
  44 public class SecureClassLoader extends ClassLoader {
  45     /*
  46      * If initialization succeed this is set to true and security checks will
  47      * succeed. Otherwise the object is not initialized and the object is
  48      * useless.
  49      */
  50     private final boolean initialized;
  51 
  52     /*
  53      * Map that maps the CodeSource to a ProtectionDomain. The key is a
  54      * CodeSourceKey class that uses a String instead of a URL to avoid
  55      * potential expensive name service lookups. This does mean that URLs that
  56      * are equivalent after nameservice lookup will be placed in separate
  57      * ProtectionDomains; however during policy enforcement these URLs will be
  58      * canonicalized and resolved resulting in a consistent set of granted
  59      * permissions.
  60      */
  61     private final Map<CodeSourceKey, ProtectionDomain> pdcache
  62             = new ConcurrentHashMap<>(11);


< prev index next >