jakarta-cactus-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vincent Massol" <vmas...@octo.com>
Subject RE: Cactus, JBoss and secured EJBs
Date Mon, 29 Apr 2002 07:23:46 GMT
Hi Ian,

 

First, I'm replying to the Cactus user list as it should go there.
Cactus 1.2 does not support testing secure code at all. Cactus 1.3 only
supports BASIC authentication. Thus you'll need to have a web.xml
configured for BASIC authentication. Once you've downloaded Cactus 1.3,
check the TestServletTestCase_Authentication.java code (it is in
sample/src/ .. 

 

Thanks

-Vincent

 

-----Original Message-----
From: Ian Butcher [mailto:ibutcher@pingtel.com] 
Sent: 26 March 2002 21:53
To: vmassol@apache.org
Subject: Cactus, JBoss and secured EJBs

 

Hi,

 

First of all, apologies for writing to you directly rather than via a
mailing list, I got your name out of one of the source files for Cactus.
Secondly congratulations on a wonderful framework.

 

My setup is JBoss+Tomcat 3.2 and a whole bunch of EJBs and JSPs deployed
in an EAR file.   I would love to unit test the EJBs separately from the
JSPs and I'm 90% there!   I have created JBoss 244 startup/shutdown,
test case and build test WAR targets in ant (shown below) and they seem
to work fine to a point.   The problem I am getting is an old favorite
of mine:

 

 [java] [INFO,J2eeDeployer] J2EE application:
file:/C:/main/packages/java/jb
44/jboss/deploy/pgs-unit.war is deployed.
 [java] [INFO,Default] in setup
 [java] [ERROR,SecurityInterceptor] Authentication exception,
principal=null

 

 [java] [INFO,Default] in setup
 [java] [ERROR,SecurityInterceptor] Authentication exception,
principal=null

 

Basically my beans are secured in the usual ejb-jar.xml mechanism and
(I'm pretty sure) my http header (created from JUnit (called by ant))
isn't providing the necessary security information.    

 

FYI: In the full system we use a JAAS module to do validation against a
RDBMS.   

 

If this were a regular old java application I could stuff the
SECURITY_PRINCIPAL and SECURITY_CREDENTIALS properties into the
initialcontext.   

 

This is my question: how can I get Ant/Cactus/JUnit to send over the
necessary security headers?

 

TIA,

 

Ian.

 

Ant tasks:

 

  <property name="jboss.home.221"
value="${packages.dir}/java/jboss244/jboss" />
    <property name="tomcat.home.221"
value="${packages.dir}/java/jboss244/tomcat" />

 

    <target name="tests_jboss_221" depends="init,pgs-unit.war">
      <!-- Start the servlet engine, wait for it to be started, run the
           unit tests, stop the servlet engine, wait for it to be
stopped.
           The servlet engine is stopped if the tests fail for any
reason -->
      <runservertests testURL="http://localhost:8080/pgs-unit"
          startTarget="start_jboss_221"
          stopTarget="stop_jboss_221"
          testTarget="run_tests"/>
    </target>

 

    <target name="start_jboss_221">
        <java classname="org.jboss.Main" fork="yes"
dir="${jboss.home.221}/bin">
            <arg value="tomcat"/>
            <classpath>
                <pathelement location="${java.home}/../lib/tools.jar"/>
                <fileset dir="${jboss.home.221}/bin">
                    <include name="run.jar"/>
                </fileset>
                <pathelement
location="${jboss.home.221}/lib/crimson.jar"/>
                <pathelement location="${jboss.home.221}/bin/run.jar"/>
                <pathelement location="${jboss.home.221}/bin"/>
                <pathelement location="${jboss.home.221}/conf"/>
                <pathelement location="${jboss.home.221}/conf/tomcat"/>
                <pathelement location="${jboss.home.221}/lib/jaas.jar"/>
                <pathelement
location="${jboss.home.221}/lib/jboss-jaas.jar"/>
                <pathelement
location="${jboss.home.221}/lib/jboss-jdbc_ext.jar"/>
                <pathelement
location="${jboss.home.221}/lib/jmxri.jar"/>
                <pathelement location="${tomcat.home}/lib/parser.jar"/>
                <pathelement location="${tomcat.home}/lib/servlet.jar"/>
                <pathelement location="${tomcat.home}/lib/jaxp.jar"/>
                <pathelement
location="${tomcat.home}/lib/webserver.jar"/>
                <pathelement location="${tomcat.home}/lib/jasper.jar"/>
                <pathelement
location="${jboss.home.221}/lib/ext/activation.jar"/>
                <pathelement
location="${jboss.home.221}/lib/ext/jboss-j2ee.jar"/>
                <pathelement
location="$jboss.home.221}/lib/ext/hsql.jar"/>
                <pathelement
location="${jboss.home.221}/lib/ext/jboss.jar"/>
                <pathelement
location="${jboss.home.221}/lib/ext/jmxtools.jar"/>
                <pathelement
location="${jboss.home.221}/lib/ext/jndi.jar"/>
                <pathelement
location="${jboss.home.221}/lib/ext/jnpserver.jar"/>
                <pathelement
location="${jboss.home.221}/lib/ext/jpl-util-0_5b.jar"/>
                <pathelement
location="${jboss.home.221}/lib/ext/mail.jar"/>
                <pathelement
location="${jboss.home.221}/lib/ext/jbossmq.jar"/>
                <pathelement location="${jboss.home.221}/db"/>
                <pathelement
location="${jboss.home.221}/lib/ext/jbossmq.jar"/>
                <pathelement
location="${jboss.home.221}/lib/ext/log4j.jar"/>
                <pathelement location="${jboss.home.221}/log"/>
                <pathelement location="${jboss.home.221}/tmp"/>
                <pathelement
location="${jboss.home.221}/lib/ext/jbosscx.jar"/>
                <pathelement
location="${jboss.home.221}/lib/ext/jbosssx.jar"/>
                <pathelement
location="${jboss.home.221}/lib/ext/jbosspool.jar"/>
                <pathelement
location="${jboss.home.221}/lib/ext/jboss-management.jar"/>
                <pathelement
location="${jboss.home.221}/lib/ext/oswego-concurrent.jar"/>
                <pathelement
location="${jboss.home.221}/lib/ext/classes12.zip"/>
                <pathelement
location="${jboss.home.221}/lib/ext/jdbc7.1-1.2.jar"/>
                <pathelement
location="${packages.dir}/java/xalan-j_2_3_1/bin/xalan.jar"/>
                <pathelement
location="${packages.dir}/java/xalan-j_2_3_1/bin/xml-apis.jar"/>
                <pathelement
location="${packages.dir}/java/jdom-b7/build/jdom.jar"/>
                <pathelement
location="${packages.dir}/java/jlog2.1.2/JLog2.1.2_aw.zip"/>
            </classpath>
        </java>
    </target>

 


    <target name="stop_jboss_221">
      <java classname="org.jboss.Shutdown" fork="yes">
          <classpath>
              <pathelement location="${java.home}/../lib/tools.jar"/>
              <fileset dir="${jboss.home.221}/lib/ext">
                  <include name="jboss.jar"/>
              </fileset>
          </classpath>
      </java>
    </target>

 

    <target name="run_tests">
        <junit printsummary="yes" haltonfailure="yes" haltonerror="yes"
fork="yes">

 

            <classpath>
                <!-- The Servlet API jar -->
                <pathelement
location="${packages.dir}/java/jboss244/tomcat/lib/servlet.jar}"/>
                <pathelement
location="${packages.dir}/java/jakarta-cactus-23-1.2/lib/cactus.jar"/>
                <pathelement
location="${packages.dir}/java/jakarta-cactus-23-1.2/lib/junit.jar"/>
                <pathelement location="test-conf"/>

 

                <!-- The test classes and classes to test -->
                <pathelement location="${build.dir}/classes"/>
            </classpath>

 

            <formatter type="plain" usefile="false"/>

 

            <test
name="com.pingtel.pds.pgs.test.TestOrganizationAdvocateEJB"/>

 

            <!-- Or you can gather all the tests in a TestAll class that
start
            them all -->

 

            <!-- Or you can use the junit task batchtest nested element
-->

 

        </junit>

 

    </target>

 


  <!--
=================================================================== -->
  <!-- Build unit test WAR
-->
  <!--
=================================================================== -->
  <target name="pgs-unit.war" depends="pgs.ejb">

 

    <javac srcdir="${src.dir}/com/pingtel/pds/pgs/test"
           destdir="${build.classes.dir}"
           debug="on"
           deprecation="on"
           optimize="on"
           includes="**/*.java"
    >
        <classpath>
            <pathelement path="${classpath}"/>
            <pathelement
location="${packages.dir}/java/jakarta-cactus-23-1.2/lib/cactus.jar"/>
            <pathelement
location="${packages.dir}/java/jakarta-cactus-23-1.2/lib/junit.jar"/>
        </classpath>
    </javac>

 

    <echo message="classes:
${build.dir}/classes/com/pingtel/pds/pgs/test"/>

 

    <war warfile="${build.dir}/pgs-unit.war" webxml="test-conf/web.xml"
>
        <classes dir="${build.dir}/classes/" casesensitive="yes" >
            <patternset>
                <include name="**/test/*.class"/>
            </patternset>
        </classes>

 

        <lib dir="${packages.dir}/java/jakarta-cactus-23-1.2/lib">
            <patternset>
                <include name="cactus.jar"/>
                <include name="junit.jar"/>
            </patternset>
        </lib>
        <lib dir="${build.dir}">
            <patternset>
                <include name="pgs.jar"/>
            </patternset>

 

        </lib>
        <lib dir="../common/build">
             <patternset>
                <include name="common.jar"/>
            </patternset>
        </lib>
    </war>

 

    <copy file="${build.dir}/pgs-unit.war" todir="${jboss.dist}/deploy"
overwrite="yes" />
  </target>


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message