• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Loading different policy files in runtime for Java SecurityManager

 
chaam Mangaleswaran
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
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 ?
 
Richard Tookey
Bartender
Posts: 1166
17
Java Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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..
 
Rishi Shah
Ranch Hand
Posts: 43
Java Mac Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Implement a custom SecurityManager based on your needs. Even if this were possible with policy files (which it's not), that method would be more inflexible and be more of a hassle.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic