org.weborganic.bastille.security
Class GetUser

java.lang.Object
  extended by org.weborganic.bastille.security.GetUser
All Implemented Interfaces:
ContentGenerator

public class GetUser
extends Object
implements ContentGenerator

Returns the XML for the user currently logged in.

The actual user implementation depends on the authentication mechanism.

A user is considered to be logged in if a User instance can be found in the current session; this happens when the user logs in.

Configuration

There is no configuration associated with this generator; however the login and logout servlets must be configured in the Web descriptor (/WEB-INF/web.xml).

Parameters

There is no parameter.

Returned XML

This generator only returns the user data if the user is logged in.

Here is a sample XML of a PageSeeder user.

<user type="pageseeder">
   <id>123</id>
   <username>jsmith</username>
   <firstname>John</firstname>
   <surname>Smith</surname>
   <email>No Email</email>
 </user>

(All elements are mandatory)

When the user is not logged in, this generator simply returns:

<no-user/>

Usage

To use this generator in Berlioz (in /WEB-INF/config/services.xml):

<generator class="org.weborganic.bastille.security.GetUser"
                         name="[name]" target="[target]"/>

Since:
0.6.2

Constructor Summary
GetUser()
           
 
Method Summary
 void process(ContentRequest req, XMLWriter xml)
          Retrieves the user from the session.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GetUser

public GetUser()
Method Detail

process

public final void process(ContentRequest req,
                          XMLWriter xml)
                   throws BerliozException,
                          IOException
Retrieves the user from the session.

Specified by:
process in interface ContentGenerator
Throws:
BerliozException
IOException