How do I detect the current security-context from a Java Applet -
I have an applet that needs access to the host system (for launching programs, queries for system settings etc.) ) The applet has been signed, and when the end user accepts my certificate, the applet's end-user is free to do whatever he wishes on the machine. If the end user rejects the certificate, the applet is still running, but it can not perform duties.
I have used System.getProperty ("java.io.tmpdir") to determine whether the applet is restricted. It works fine with Windows, but somehow Java behaves differently on Mac OS. (I thought that part of the point with Java was a system-independent language with well-defined behavior - but I end up writing a specific code for Mac and Windows - like I do with C ++) .
Is there a reliable way to define security - is the inside of the applet running?
public stable boolean is trusted (security manager security = System.getSecurityManager); If (security == zero) {return true; } And {try {security.checkPermission (new AllPermission ()); Back true; } Grip (Security Exception AX) {return false; }}}
(General disclaimer: not tested, not compiled)
Comments
Post a Comment