Loading different policy files in runtime for Java SecurityManager
Joined: Sep 14, 2012
I am trying to load different policy file during run time. I am trying to have different policy files for different users in my system. Hence I'm checking their ID and with the ID Key I'm trying to set a policy file ( something like policy.url.ID) I am trying to set the policy URLs using the method System.setProperty("java.security.policy",url). But I don't have the privilege to do so(I'm getting java.security.AccessControlException)
When I set the policy URLs are set I was trying to set the policy file using Policy.setPolicy(Policy p ) I want to know where I went wrong and what will be the best way to set java policy files in run time ?
Joined: Aug 27, 2012
Consider the security implications if a Java program could define which policy file should be used. If the new policy file is tighter than the original then nothing would change; the program could still do anything that the original policy file allowed. If the new policy file is more relaxed that the original then it would allow the Java program to do things that it the system manager did not want to allow. This would make nonsense of having a policy file in the first place..