4.5. SecureClassLoader Details

The java.security.SecureClassLoader class extends ClassLoader with additional support for defining a class, given the code source of the class. During Java 2 development, this class initially had a richer design with a comprehensive set of method calls. Gradually, those functionalities have been moved either to the base class ClassLoader or to the newly created class URLClassLoader.

The two main methods of the SecureClassLoader class are the following:

protected final Class defineClass(String name, byte[] b,
                     int off, int len, CodeSource cs)
protected PermissionCollection getPermissions(CodeSource
                                       codesource)

The defineClass method defines a class from a particular code source. In some sense, this method duplicates ...

Get Inside Java™ 2 Platform Security: Architecture, API Design, and Implementation, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.