University of Cincinnati logo and link  
Security Manager, Security Exception Detailed
 
  UC ingot If a SecurityManager does not want to grant a request, it throws a SecurityException.
  • With SecurityManager, we are really only concerned with the two signatures of the checkPermission method.
    • One argument - permission - checks the permission in the current thread.
    • Two arguments - permission and context - checks the permission with the thread snapshot in the context object.
  • SecurityException is little more than a normal Exception.
    • It has the same constructor.
    • But, keep in mind, since it is a different class it can have its own catch blocks and throws statements.
  • To set a Security Manager for an application, use:
    • System.setSecurityManager(SecurityManager manager)
    • You can make your own or use the default.
  • All the permissions you'll ever want to know can be found in Permissions in the Java 2 SDK at http://java.sun.com/j2se/1.4.1/docs/guide/security/permissions.html
 Java 2 Security