Signed Java applets have the same security permission as a regular Java application running on the client. For a specific project, I need these permissions, and I need to perform privileged operations as a result of a JavaScript call.
Now the problem is that, at least for Firefox 3 in Ubuntu (target browser and platform), when the applet method is invoked through unsigned JavaScript, it loses its special permissions. Since signing JavaScript is not an option, I need a way around this limitation.
One way to achieve this is to create a thread when you start the applet and call methods on that thread whenever the main thread receives JavaScript calls. I implemented a working prototype of this idea, but I found it a little awkward because it uses too many reflections and is not as easy to reuse as I would like.
Is there a normal standard way to do what I'm trying to do? And, if my idea is the right way, how could you implement it reusable? What I'm trying to achieve is a structure that allows this running-methods-in-a-privileg-thread thing to be used for many objects. An ideal, utopian solution would be something like:
// when the applet starts-up PrivilegedExecuter priv = new PrivilegedExecuter(myObject); //or MyClass.class // ... // inside a JavaScript-called method (myObject has myMethod) priv.myMethod(); // myMethod is run synchronously in a privileged thread
java javascript security applet
Pedro d'quino
source share