java.policy programmatically modification & SocketPermission

O

oziris

Hi !


For my application I allow users to modify several settings and one of
them is the list of IP which are authorized to connect to a server
socket.


I know that consists in using SocketPermission class.


The stuff is that configuration should be intuitive so I want users do
not have to modify directly the java.policy file but just a simple
properties file.


Does it possible to modify programmatically java.policy? Or have I to
develop a routine that perform this check (IP related), so without
using AccessController and SecurityManager?


Thanks a lot for your advices.


-o--
 
S

Shin

I may not understand your situation correctly, but here is a few
options I can think of:

1. the user can have a customized policy file, say, test.policy, and
this can be passed to the application when lauching java

2. you can consider using AccessController.doPriviledged(..) in your
class where you first check whether the IP is allowed, then wrap the
connection code inside a priviledged action.
The list of allowed IPs can be build at the start of the program by
reading some regular file user can modifiy.

-Shin
 

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

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top