• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

What kind of Policy file ?

 
Vikas Sood
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi friends,
I am using factory pattern for providing a seperate RemoteData object per client.I create an object of Data in this factory clas and pass it to every new RemoteData object.
I have given java.security.filePermission (all) in my policy file so as to pass a dbfile name while starting the server.Apart from this permission i have also provided other permissions for running of rmi.
i want to know,do we neeed to provide a policy file giving only specific permissions or i can use java.security.AllPermission for this purpose.
Kindly suggest an approach.
VikasSood
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can just use AllPermissions.
Or even better yet, since there is no dynamic downloading of classes. you can forget about using a policy file and SecurityManager completely.
It is not needed to use them at all.
Mark
 
Vikas Sood
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Mark,
Originally posted by Mark Spritzler:
You can just use AllPermissions.
Or even better yet, since there is no dynamic downloading of classes. you can forget about using a policy file and SecurityManager completely.
It is not needed to use them at all.
Mark

As i have mentioned in my earlier quote that i am instantiating an insance of Data class in my ConnectionFactory class,which can be passed a string on start of server representing the location of the db file to work upon.I was not giving any permissions in my policy file to start with,but when i tried to start my server ,i got an AccessControlException stating filePermissions not available,so i gave all for filePermissions in my policy file,then only was able to start my server.
So i think we have to give either specific permissions or All permissions in my case otherwise my server will not run.What do u think about it ,kindly comment.
VikasSood.
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could remove that System.setSecurityManager line out of your code and then you do not need a policy file.
No Security Manager no need for policy file.
Mark
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic