Gene Chuang wrote:
>
> A client can only access an EJB if it knows its JNDI name.  Correct me if
> I'm wrong, but there's no JNDI command to manifest all available services.
> So a superficial, if rather weak, way to secure your beans is to reveal only
> public bean JNDI names to your client.
>
> Gene

I wrote the following program to print out everything that was listed
with the JNDI service in WebSphere. The output was fascinating; I have
included that as well.

Vance

Vance Christiaanse
Cintech Consulting

import javax.naming.*;
import java.util.Properties;

class JNDIList {
   private static void list(InitialContext ic, String name, String
className) {
      try {
         NamingEnumeration ne = ic.list(name + "/");
         while (ne.hasMore()) {
            NameClassPair       ncp     = (NameClassPair)ne.next();
            String      nextName        = name + "/" + ncp.getName();
            String      nextClassName   = ncp.getClassName().toString();
            list(ic, nextName, nextClassName);
         }
      } catch (NamingException e) {
         System.out.println(name);     // Note: Could also print
className here
      }
   }
   public static void main(String[] args) {
      try {
         Properties p = new Properties();

         p.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY,
                  "com.ibm.ejs.ns.jndi.CNInitialContextFactory");

         InitialContext ic  = new InitialContext(p);

         list(ic, "", "");
      } catch (NamingException e) {
         System.out.println("Got " + e);
      }
   }
}

The output:

/jta/usertransaction
/EmployeeHome
/IncBean
/BeenThereBean
/jdbc/MyDataSource
/jdbc/Default DataSource
/9.2.67.42/resources/sec/SecurityServer
/ejsadmin/node/cpu12545/version
/ejsadmin/node/cpu12545/homes/ApplicationHome
/ejsadmin/node/cpu12545/homes/LTPAServerHome
/ejsadmin/node/cpu12545/homes/JDBCDriverHome
/ejsadmin/node/cpu12545/homes/GlobalSecuritySettingsHome
/ejsadmin/node/cpu12545/homes/UserProfileHome
/ejsadmin/node/cpu12545/homes/URIHome
/ejsadmin/node/cpu12545/homes/FileBrowserServiceHome
/ejsadmin/node/cpu12545/homes/SessionMgrHome
/ejsadmin/node/cpu12545/homes/ServerHome
/ejsadmin/node/cpu12545/homes/EJBContainerHome
/ejsadmin/node/cpu12545/homes/CreateURIHome
/ejsadmin/node/cpu12545/homes/TraceServiceHome
/ejsadmin/node/cpu12545/homes/LTPAConfigHome
/ejsadmin/node/cpu12545/homes/SeriousEventReaderHome
/ejsadmin/node/cpu12545/homes/ApplicationSecurityHome
/ejsadmin/node/cpu12545/homes/RegistryHome
/ejsadmin/node/cpu12545/homes/SecurityServerHome
/ejsadmin/node/cpu12545/homes/CreateApplicationHome
/ejsadmin/node/cpu12545/homes/ConfigureResourceSecurityHome
/ejsadmin/node/cpu12545/homes/CreateServerHome
/ejsadmin/node/cpu12545/homes/TypeHome
/ejsadmin/node/cpu12545/homes/ServletHome
/ejsadmin/node/cpu12545/homes/ConfigureApplicationSecurityHome
/ejsadmin/node/cpu12545/homes/EnterpriseBeanSecurityHome
/ejsadmin/node/cpu12545/homes/CreateDataSourceHome
/ejsadmin/node/cpu12545/homes/AuthorizationTableHome
/ejsadmin/node/cpu12545/homes/MethodGroupHome
/ejsadmin/node/cpu12545/homes/EJBServerHome
/ejsadmin/node/cpu12545/homes/AssignPermissionsHome
/ejsadmin/node/cpu12545/homes/ModelHome
/ejsadmin/node/cpu12545/homes/SecurityConfigHome
/ejsadmin/node/cpu12545/homes/EditApplicationHome
/ejsadmin/node/cpu12545/homes/groupRegistryEntryHome
/ejsadmin/node/cpu12545/homes/RelationHome
/ejsadmin/node/cpu12545/homes/ServletEngineHome
/ejsadmin/node/cpu12545/homes/ServletRedirectorHome
/ejsadmin/node/cpu12545/homes/userRegistryEntryHome
/ejsadmin/node/cpu12545/homes/DeployEJBHome
/ejsadmin/node/cpu12545/homes/ServletGroupHome
/ejsadmin/node/cpu12545/homes/EnterpriseBeanHome
/ejsadmin/node/cpu12545/homes/CreateServletGroupHome
/ejsadmin/node/cpu12545/homes/EpmServiceHome
/ejsadmin/node/cpu12545/homes/TranServiceHome
/ejsadmin/node/cpu12545/homes/DataSourceHome
/ejsadmin/node/cpu12545/homes/SeriousEventLoggerHome
/ejsadmin/node/cpu12545/homes/ClientAccessHome
/ejsadmin/node/cpu12545/homes/NodeHome
/ejsadmin/node/cpu12545/homes/VirtualHostHome
/ejsadmin/node/cpu12545/homes/WorkWithMethodGroupHome
/SecurityCurrent
/RemoteSRPHome

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to