File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Dynamic connection mode changing Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Dynamic connection mode changing" Watch "Dynamic connection mode changing" New topic
Author

Dynamic connection mode changing

Andras Nemeth
Ranch Hand

Joined: Jul 31, 2001
Posts: 80
Hello,
I did my assignment so that the user can change the connection
mode anytime. It works fine except one case:
The user selected network mode (and failed) :
And later wants to change to local mode. The connection failed,
because of security problem with
access denied (java.io.FilePermission .\suncertify\db\db.db write)
The problem is that at RMI connection I set the RMISecurityManager and when I want to make a new local connection it is exists.
I tried to use
System.getSecurityManager when I start the client to save the original SecurityManager and set it back when local connect is called. But, at this time I do not have rights to set the SecurityManager... (Should this kind of right to the policy file which is used by RMISecurityManager?)
Any good idea?
Br,
Ban
Peter den Haan
author
Ranch Hand

Joined: Apr 20, 2000
Posts: 3252
Andras, you're going over the top. Why not simply let the user choose the mode once, when the application is started.
- Peter
Andras Nemeth
Ranch Hand

Joined: Jul 31, 2001
Posts: 80
Hi Peter,
Originally posted by Peter den Haan:
Andras, you're going over the top. Why not simply let the user choose the mode once, when the application is started.
- Peter

As always you are right! But, because of the design of my GUI and (thanx to your driving) connection factory let it doing easy. I just didn't think I will run into this kind of problem. Anyhow, I solved it with putting allow setSecurityManager sec. in my client policy file.
BTW, I read about security in Core Java and they do not suggest using security manager at server side, at all. What is your exprience with it.
Thanks a lot. I really appreciate your help.
Cheer up,
Ban
Peter den Haan
author
Ranch Hand

Joined: Apr 20, 2000
Posts: 3252
Regarding security in a production environment, I think "totally paranoid" is the right frame of mind (the folks at Redmond would disagree with me). I'd want to hammer security tightly on the server side as well as the client side if I had my way. Should the server have a security problem and be compromised, the Java security settings are another line of defense before an attacker can read secret documents or read operating system files.
For the assignment, it's another matter. Yes, I did provide both client-side and server-side security policies, but they weren't terribly restrictive or sophisticated. My best guess is that you're alright taking the easy way out and enabling the setting of a security policy, even though that seriously weakens the entire security set-up.
- Peter
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Dynamic connection mode changing