Tequila Java client howto

Using the Tequila client for your Java application is very simple :

1. Copy the tequila-client.jar in your WEB-INF/lib directory.

2. In your /WEB-INF/web.xml file, add the following lines :

  <filter>
    <filter-name>TequilaFilter</filter-name>
    <filter-class>ch.epfl.tequila.client.system.TequilaFilter</filter-class>
    <init-param>
       <param-name>host</param-name>
       <param-value>tequila.epfl.ch</param-value>
    </init-param>
    <init-param>
       <param-name>service</param-name>
       <param-value>My Tequila Service</param-value>
    </init-param>
    <init-param>
      <param-name>request</param-name>
      <param-value>uniqueid firstname name</param-value>
    </init-param>
  </filter>

  <filter-mapping>
    <filter-name>TequilaFilter</filter-name>
    <url-pattern>/protected/*</url-pattern>
  </filter-mapping>

And replace all the values in bold according to your configuration. All the other Tequila
parameters (wish, require, wantrole, authstrength etc.) are supported and can be specified
as parameters of the TequilaFilter e.g. :


  <init-param>
    <param-name>whish</param-name>
    <param-value>phone where</param-value>
  </init-param>

etc.

The filter-mapping defines which urls must be protected by Tequila (in our example
all the urls starting with "/protected/").

You can use all the power of Servlet filters for advanced purposes like requiring a different role
according to urls patterns, see filters documentation for more informations.

After a successful login the authenticated user can be retrieved with the standard request.getUserPrincipal() method.

The returned type is TequilaPrincipal which has special methods specific to Tequila, see the javadoc.