new SecurityManager and SocketPermission

Hello,

To secure a distributed application, we use a ClassLoader to apply our security policy to restrict access only to some files.

I can't execute the application yet so I'm wondering about another point concerning socket communications.

For example, whith the code socket.getInetAddress().getHostAddress()

Do I have to add a new SocketPermission ? If so, with witch action (accept, connect, listen, resolve) ?

How do I know which method requires which Permission ?

Could that code work without it ?

Thanx.

[559 byte] By [JeanBeulza] at [2007-9-23]
# 1

Having an AccessControl Exception

java.security.AccessControlException: access denied (java.net.SocketPermission 172.16.2.16:60001 connect,resolve)

, I added a SocketPermission to my security policy by

new SocketPermission(new String (nr.getPrivateInetAddress() // 172.16.2.16

+":" + nr.getPrivatePort()), // 60001

"connect, resolve");

and I still have this exception.

Anyone could help ?

JeanBeulza at 2007-7-11 > top of java,Security,Other Security APIs, Tools, and Issues...