EJB Security on JBoss

The JAAS security is supported only by JProxy Commercial Release!

To test JProxy with EJB security please use TestSessionBean sample 
from JProxy distribution loacated in samples.jar. 

The test is setup for JBoss 3 with some minor modifications it may be used on WebLogic. 

In the following EJB security sample is setup for default "other" login-module.

You can find its configuration in JBoss jboss/server/default/conf/login-config.xml

In proxyservlet.war/WEB-INF/classes/com/jproxy/proxy/proxy.properties
set following properties:

com.jproxy.proxy.tunnel.invocation.interceptor = com.jproxy.proxy.providers.JaasInvocationInterceptor
com.jproxy.proxy.jaas.configuration.name = other


To execute TestSessionBean "Performance" sample from command line:
%JAVA_HOME%\bin\java -cp samples.jar;proxyclient.jar;j2api.jar \
  com.jproxy.samples.ejb.test.PerformanceClient \
  -Djava.naming.security.principal=admin \
  -Djava.naming.security.credentials=12345678 \
  loops=1 bytes=100 threads=1 mode=EJB url=localhost

Notice that user name and password specified after class name as main-method argument : 
-Djava.naming.security.principal=admin
-Djava.naming.security.credentials=12345678

The example assumes that there is a user "admin" with password "12345678" 
exists in JBoss realm. 

Here are deployment descriptors for samples.jar EJB archive utilizing EJB security:

samples.jar/META-INF/ejb-jar.jar 
==============================================================
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
<!-- Deployment descriptor for jproxy test beans -->
<ejb-jar>
  <enterprise-beans>
    <session>
      <description>The JProxy Test Session Bean</description>
      <ejb-name>TestSessionBean</ejb-name>
      <home>com.jproxy.samples.ejb.test.ISessionHome</home>
      <remote>com.jproxy.samples.ejb.test.ISession</remote>
      <ejb-class>com.jproxy.samples.ejb.test.SessionEJB</ejb-class>
      <session-type>Stateless</session-type>
      <transaction-type>Container</transaction-type>
    </session>
  </enterprise-beans>

  <assembly-descriptor>

    <!-- uncomment for EJB security testing -->
    <security-role>
      <role-name>administrators</role-name>
    </security-role>
 
    <method-permission>
    <role-name>administrators</role-name>
      <method>
        <ejb-name>TestSessionBean</ejb-name>
        <method-name>*</method-name>
      </method>
    </method-permission>

  </assembly-descriptor>

</ejb-jar> 
===============================================================


samples.jar/META-INF/jboss.jar 
===============================================================
<?xml version="1.0" encoding="UTF-8"?>
<jboss>
  <security-domain>java:/jaas/other</security-domain>

  <enterprise-beans>
    <!-- uncomment it if you want create your own JNDI mapping
    <session>
      <ejb-name>TestSessionBean</ejb-name>
      <jndi-name>ejb/TestSessionBean</jndi-name>
    </session>
    -->
  </enterprise-beans>
</jboss> 
===============================================================


jboss-3.2.1/server/default/conf/users.properties
===============================================================
admin=12345678 
===============================================================


jboss-3.2.1/server/default/conf/roles.properties
===============================================================
admin=administrators 
===============================================================
