$Id$
@author Florent Benoit

Example Overview:
=================

This example shows how to use JAAS login modules for the authentication.

There are two kind of clients.
 - Without the use of the client container
 - With the use of the client container

First kind of client (without client container)
-----------------------------------------------
This example includes several ways of entering login and password (CallBack)
 - The first way is a command line prompt
 - The second way is a swing dialog (a window)
 - The first way works without asking the user a login/password.
   The login and password are given to the callbackhandler by the client

You can configure the login module and the resource to use by configuring
the file in the JONAS_ROOT/conf/jaas.config file.

There are two login modules :
 - One for performing the authentication
 - One for propagating to the JOnAS server the security context


Second kind of client (with client container):
-------------------------------------------------
The choice of the callback handler is done in the application-xml file.

Two examples of clients are provided.
 - jaasopclient1.jar uses the NoInputCallbackHandler as a login/password is
   specified in the jonas-client.xml file

 - jaasopclient2.jar uses the CallbackHandler specified in the file
   application-client.xml

 - jaasopclient3.jar uses Swing CallbackHandler specified in
   application-client.xml file and launch a Swing client

Both of them use the jaas configuration which is in the client.jar under the
name "jaas.config"

The JAAS initialization and authentication is perfomed by the client container.


Compiling and installing this example:
--------------------------------------
 do : ant install

Running this example:
--------------------

1) Run a jonas server:
	jonas start

2) Load the jaasop.jar if you have not added it in the ejb service descriptors list :
	jonas admin -a jaasop.jar

You should see something like this when the bean is loaded :
	
	JAASOp available

3) Run the client program:

a/ The client without client container :
   -------------------------------------
on UNIX:
	jclient -cp $JONAS_BASE/ejbjars/jaasop.jar jaasclient.ClientJAASOp <text|dialog|noprompt>

On Windows:
	jclient -cp %JONAS_BASE%\ejbjars\jaasop.jar jaasclient.ClientJAASOp <text|dialog|noprompt>
	
In fact, the "-cp" option is not useful here, because classes are found in the CLASSPATH.

b/ A client with client container :
   --------------------------------
first client :
java -jar $JONAS_ROOT/lib/client.jar $JONAS_BASE/clients/jaasopclient1.jar

second client :
java -jar $JONAS_ROOT/lib/client.jar $JONAS_BASE/clients/jaasopclient2.jar

third client :
java -jar $JONAS_ROOT/lib/client.jar $JONAS_BASE/clients/jaasopclient3.jar

4) Stop the jonas server
	jonas stop
