public static class AsClient2 implements PrivilegedExceptionAction {
public Object run() throws Exception {
Security.verifyObjectTrust(sys, null, trustCtx);
// cannot call registerGroup
try {
sys.registerGroup(new ActivationGroupDesc(null, null));
throw new RuntimeException("client2 able to registerGroup");
} catch (SecurityException e) {
}
// cannot call getActivationGroupDesc
try {
sys.getActivationGroupDesc(gid);
throw new RuntimeException(
"client2 able to getActivationGroupDesc");
} catch (SecurityException e) {
}
CommandEnvironment env =
new CommandEnvironment("foobar", new String[]{"-baz"});
// can set java program to "foobar" and option "-baz"
sys.setActivationGroupDesc(gid,
new ActivationGroupDesc(null, env));
env = new CommandEnvironment("baz", null);
// cannot set java program to "baz"
try {
sys.setActivationGroupDesc(gid,
new ActivationGroupDesc(null,
env));
throw new RuntimeException(
"client2 able to setActivationGroupDesc with program baz");
} catch (SecurityException e) {
}
// cannot set java program to "foobar" and option "-foobar"
env = new CommandEnvironment("foobar", new String[]{"-foobar"});
try {
sys.setActivationGroupDesc(gid,
new ActivationGroupDesc(null, env));
throw new RuntimeException(
"client2 able to setActivationGroupDesc with option -foobar");
} catch (SecurityException e) {
}
// can call setActivationGroupDesc to set to default
sys.setActivationGroupDesc(gid,
new ActivationGroupDesc(null, null));
// can call registerObject
ActivationID aid =
sys.registerObject(new ActivationDesc(gid, "Foo", null, null));
// cannot call activate
try {