How to provide policies for RMI at run-time?

R

Royan

Normally there would be a policy file on the disk, but is there a way
I can set policies at run-time? I mean is there a way I can set this:

grant {
permission java.security.AllPermission;
};

from code?

PS
No, i'm not looking for a security breach, just wonder if such
approach is possible?
 
A

Abhijat Vatsyayan

Royan said:
Normally there would be a policy file on the disk, but is there a way
I can set policies at run-time? I mean is there a way I can set this:

grant {
permission java.security.AllPermission;
};

from code?

PS
No, i'm not looking for a security breach, just wonder if such
approach is possible?
If you must, :))

You can set a security manager through the System.setSecurityManager
method. So subclass SecurityManager and override all checkXXX methods
with whatever you want it do to. Or better still , just override
checkPermission(Permission perm) method . You should also look at the
documentation for RMISecurityManager and source code of the two security
managers. Your code will need permission to create security manager
though. Its a pretty dangerous thing to do though so be careful where
you use this.

Abhijat
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top