This is a fairly uptight security manager subclass. Classes loaded by
the PluginClassLoader are highly restricted in what they are allowed to do.
This is okay, because they're only supposed to calculate some values,
for which all necessary data is already available to them.
A SecurityManager consists of various methods that the system calls to
check whether certain sensitive operations should be allowed. These
methods can throw a SecurityException to prevent the operation from
happening. With this SecurityManager, we want to prevent untrusted
code that was loaded by a class loader from performing those sensitive operations.
So we use inherited SecurityManager methods to check whether the call is being
made by an untrusted class. If it is, we throw an exception.
Otherwise, we simply return, allowing the operation to proceed normally.
This class has been altered to fit this project needs.
We would like to thank the author of its original version, Ulf Dittmer.
Original version available at
SECURITY ISSUE: Currently, this security manager is not being used by the framework.
All classes are being loaded with the default security manager, what is a security
These are all the specific checks that a security manager can
perform. They all just call one of the methods above and throw a
SecurityException if the operation is not allowed. This
SecurityManager subclass is perhaps a little too restrictive. For
example, it doesn't allow loaded code to read *any* system properties,
even though some of them are quite harmless.
This is the one SecurityManager method that is different from the
others. It indicates whether a top-level window should display an
"untrusted" warning. The window is always allowed to be created, so
this method is not normally meant to throw an exception. It should
return true if the window does not need to display the warning, and
false if it does. In this example, however, our text-based Service
classes should never need to create windows, so we will actually
throw an exception to prevent any windows from being opened.