File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes BEA/Weblogic and the fly likes Security Principal Problem, local and remote Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » BEA/Weblogic
Bookmark "Security Principal Problem, local and remote" Watch "Security Principal Problem, local and remote" New topic

Security Principal Problem, local and remote

Aps Raps

Joined: Aug 09, 2004
Posts: 2
I have a web application running on the local server, accessing EJBs on a remote server. The local principal needed to access the web application is not the same as the remote user credentials.
1. Before invoking an ejb method from a delegate, I create the InitalContext with the required remote credentials and invoke the EJB.
2. After invocation I close the remote context explicitely so as to access my web application.

If I dont close the remote context, my web app stops working. If I close the remote context, I have to do a get InitialContext before each EJB method invocation and this can be expensive.

Can local and remote context co-exist? Is there some way by which I can avoid getting the initial context each time in the delegate? Would appreciate any help here.
Rovas Kram
Ranch Hand

Joined: Aug 08, 2003
Posts: 135
I think you can just change the environment before and after you call the remote server - without closing the context.

Hashtable env = Context.getEnvironment();
env.put("", "YourPrincipal");
I agree. Here's the link:
subject: Security Principal Problem, local and remote
It's not a secret anymore!