Copyright (C) BULL S.A. 1998, 1999, 2000.

-------------------------------------------------------------
		WARNING!

At the present time, the security works in JOnAS only if :
- the EJB are accessed by a servlet in Tomcat, v3.1
- The ORB used is JEREMIE (RMI support will be added later)

-------------------------------------------------------------

Introduction
------------
This examples shows how to access an EJB in JOnAS from a servlet in Tomcat.
Moreover, it uses security both in Tomcat to authentificate the user and in JOnAS to authorize
him to access the methods of the EJB.
the subdirectory sb contains the EJB Op. It is the same EJB than in the examples/src/sb 
directory with the addition of security access to the methods of the bean.
the subdirectory ejbSample contains files and directories to create a web application. When the
example is compiled, it creates a file named ejbSample.war which is the web application which
will be used by Tomcat to run the servlet.

Prerequisite to compile and run the example :
---------------------------------------------
First, you've to install Tomcat (version 3.1), this includes to set the environment 
variable TOMCAT_HOME to the directory where you have installed Tomcat.

Copy the file $JONAS_ROOT/tomcat-jonathan.prop to $TOMCAT_HOME and rename 
it jonathan.prop.
On Unix:
cp $JONAS_ROOT/tomcat-jonathan.prop $TOMCAT_HOME/jonathan.prop

On Windows:
copy $JONAS_ROOT\tomcat-jonathan.prop $TOMCAT_HOME\jonathan.prop

Make sure that the file $JONAS_ROOT/jonathan.prop is located in your class path. 
Typically, copy it in the same location than the jndi.properties file you have modified.

Modify the $TOMCAT_HOME/conf/server.xml :
Add    
<RequestInterceptor 
	className="org.objectweb.security.tomcat.interceptor.SecurityCtxInterceptor31"
/>
after 
<RequestInterceptor 
	className="org.apache.tomcat.request.SecurityCheck"
/>

Compiling this example:
-----------------------
On example/src/security, run make.
this compiles the EJB "Op" and creates the war file ejbSample.war located in the 
subdirectory ejbSample.
In order to compile the servlet, the servlet.jar file of tomcat must be in 
the class path.

Running this example:
---------------------
Make sure that a "registry" is running.

Copy the war file examples/src/security/ejbSample/ejbSample.war into $TOMCAT_HOME/webapps

On Unix:
Run an EJB Server to make beans available to clients:
	cd examples/src/security/sb	
	EJBServer

Run tomcat
	. $JONAS_ROOT/bin/unix/config_env	# set CLASSPATH
	$TOMCAT_HOME/bin/tomcat.sh start

Run your web browser (e.g., netscape):
	netscape http://<hostname>:<port>/ejbSample
	where <hostname> is the name of your machine (localhost by default)
	and <port> the port number (8080 by default)
	
	Follow the instructions.

On Windows:
Run an EJB Server to make beans available to clients:
	cd examples\src\security\sb
	EJBServer
Run tomcat
	config_env	# set CLASSPATH
	$TOMCAT_HOME\bin\tomcat.bat start

Run your web browser (e.g., netscape):
	netscape http://<machine>:<port>/ejbSample
	where <machine> is the name of tour machine (localhost by default)
	and <port> the port number (8080 by default)
	
	Follow the instructions.

	
