Forum Stats

  • 3,814,410 Users
  • 2,258,870 Discussions
  • 7,892,703 Comments

Discussions

Security Manager and RMI

843811
843811 Member Posts: 49,851
I am developping an application that uses RMI.
So in the code i must declare the RMISecurityManager as the security manager. But if the user specify the standard security manager on the command line it dont works.
I understand why, because my question is :
How the user can ensure that my application is safe if he cannot specify the basic security manager on the comnd line ( -Djava.security.manager ) ?

tom

Comments

  • 843811
    843811 Member Posts: 49,851
    First of all, you don't have to use RMISecurityManager as the security manager at all. It's a legacy class from Java 1.1. times that the RMI tutorials continue to refer to, see this thread:

    http://forum.java.sun.com/thread.jsp?forum=58&thread=161874

    Secondly, it is tricky but Java 2 allows a security manager to be set more than once -- it all depends on whether the currently installed manager allows to be replaced [RuntimePermission("setSecurityManager") permission].

    Finally, if you expect that the user will define a security policy through command line, all you have to do is code something like this:
    if (System.getSecurityManager() == null)
       System.setSecurityManager(your_security_manager);
    to set yours only when nothing was set on the command line.

    Vlad.
  • 843811
    843811 Member Posts: 49,851
    Was my answer helpful?
  • 843811
    843811 Member Posts: 49,851
    I don�t know if it was helpful for tom, but for me yes.
    Pablo
  • 843811
    843811 Member Posts: 49,851
    Yes, Thank you vladimp

    tom
This discussion has been closed.