411 REFERENCE · Wikibooks
Java Programming/Java Security
Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.
Java Security
__NOTOC__
Since Java 1.2, the Java platform itself comes with a security model built into applications it runs. It provides an access controller similar to what the Java enabled browser provides for an applet.
There are two main ways we can add security to our application. One way is to add a Class loader, or a security manager. The other way is to run your application under an other program, that can be called JavaRunner. JavaRunner can be used to run applications, the same way as appletviewer is used to run applets.
Permissions in Java
Permissions in Java grant or deny certain privileges to an application. Take this file from an applet called "Desert":
grant {
permission java.security.AllPermission;
};
This file says to allow every permission (i.e. no security). Take also this code:
import java.io.*;
perm = new FilePermission("/tmp/wikibooks-test", "read");
This represents permission to allow reading of /tmp/wikibooks-temp. For more information see this.
Language Security
Security and the Class Loader
0%