Inside Scoop on J2EE : Tips and tricks on J2EE and Oracle Application Server by Debu Panda
Updated: 4/26/2005; 8:00:30 AM.

 

Subscribe to "Inside Scoop on J2EE" in Radio UserLand.

Click to see the XML version of this web page.

Click here to send an email to the editor of this weblog.

 
 

Tuesday, April 26, 2005

From time to time we get complaints from partners and customers that OC4J do not support anonymous EJB lookup and execution of EJB methods. This means you do not specify the principal and credential when creating the InitialContext. For example, if you are trying to lookup a remote EJB in OC4J your jndi.properties will look like follows:

 

java.naming.factory.initial=oracle.j2ee.naming.ApplicationClientInitialContextFactory

java.naming.provider.url=ormi://localhost:23791/ejb30slsb

java.naming.security.principal=

java.naming.security.credentials=

 

In my opinion security is a practice that starts during development and I view this as a big security hole in the applications because you are leaving your EJBs in ejb30slsb” applications to be executed by anyone and I will advise against doing this.

 

Anyway many of us do not care until we are bitten and want to use anonymous EJB lookup because they do not care and have been doing this for years in some other application servers and want to continue the bad practice in OC4J. We have been looking at this for years and not implementing because our security practice would not allow such an implementation to be available out of the box.

 

However for those folks, who do not care for securing their EJBs, we provide a solution to configure OC4J to allow anonymous EJB lookup and I tried this in OC4J 10.1.3 and it works great. Here are the steps you have to do:

 

  1. Assign anonymous user in config/jazn-data.xml to a more privileged role/group that has RMI permissions

 

 

<role>

                        <name>users</name>

                 

                               <member>

                                    <type>user</type>

                                    <name>anonymous</name>

                              </member>

                        </members>

                  </role>

 

2. Make sure that group/role has name space access to that applications and permissions to execute EJB methods. Provided users role to access to the EJB by specifying the following in orion-application.xml packaged in the EAR.

 

<namespace-access>

            <read-access>

                  <namespace-resource root="">

                        <security-role-mapping name="&lt;jndi-user-role&gt;">

                              <group name="administrators" />

                              <group name="users" />

 

                        </security-role-mapping>

                  </namespace-resource>

            </read-access>

            <write-access>

                  <namespace-resource root="">

                        <security-role-mapping name="&lt;jndi-user-role&gt;">

                              <group name="administrators" />

                                <group name="users" />

                        </security-role-mapping>

                  </namespace-resource>

            </write-access>

      </namespace-access>

 

 

Now you should be able to access remote EJBs without specifying principals and credentials making your EJBs free for all.

 

THINK twice before you do this!


7:11:51 AM    comment []

© Copyright 2005 Debu Panda.

PS: These are my own thoughts and not of my employer ..



Click here to visit the Radio UserLand website.
 


April 2005
Sun Mon Tue Wed Thu Fri Sat
          1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
Mar   May