Generator: GetUser
| Class name: | org.weborganic.bastille.security.GetUser | 
|---|---|
| Version: | 0.6.27 - 29 November 2011 | 
| Library: | Bastille | 
| Cacheable: | No | 
| Generated: | 2012-12-21 | 
Description
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 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]"/>