Introduction - If you have any usage issues, please Google them yourself
Privileged code in Java is a "all-or-nothing" proposition. While it does allow a normal user
to execute some operations that would notmally require granting higher privileges (like viewing
files in his particular directory), it may have a side-effect of exposing undesired operations,
which can open up a security hole in the system.
An explanation of the example:
1. Operations class contains file-related methods- listing of all files and deleting a file
2. PrivilegedCode class is a privileged wrapper around those operations
3. Both of those classes are combined into a single jar, which is granted high level of trust
4. Normally, any file operations require granting a special permission, so an attempt to directly execute calls on Operations class by an untrusted client fails
5. However, when the same untrusted client executes the same operations through the privileged interface, it succeeds, including deleting an arbitrary file passed on command line