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

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
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("java.naming.security.principal", "YourPrincipal");
I agree. Here's the link: http://aspose.com/file-tools
subject: Security Principal Problem, local and remote
Similar Threads
Propagating the user Principal
Why can't we reuse an interface for both remote and local clients?
delegate options
Security Context Propagation
Need help implementing security on RMI based JMX console client connection