A Simple Example of a SecurityManager

Here is a simple example of a security manager.
It is intended for use by a program that hosts other programs, such as a batch processing shell. The security policy that it implments is to prevent hosted programms from sucessfully calling System.exit, while still allowing the hosting program to do so.

The way that it distinguishes between methods in the hosting program and hosted methods is that it expects the hosting program to invoke the hosted program using a class called Invoker.

I also have a simple example that uses these classes. It consists of an application that installs the security manager and then uses the Invoker class to invoke a class that just calls System.exit


Return to Mark Grand's home page.