• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

Loading different policy files in runtime for Java SecurityManager

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ?
 
Bartender
Posts: 1166
17
Netbeans IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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..
 
Ranch Hand
Posts: 43
Mac Ruby Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic