org.apache.cocoon.auth
Interface User

All Known Implementing Classes:
PipelineSecurityHandler.PipelineSHUser, PortalUser, ServletSecurityHandler.ServletUser, StandardUser

public interface User

This object represents the current user. Each user must have a unique identifier (per SecurityHandler). For session replication, the implementation should be Serializable.

Version:
$Id: User.html 1304258 2012-03-23 10:09:27Z ilgrosso $

Method Summary
 Object getAttribute(String key)
          Get information about the user.
 Iterator getAttributeNames()
          Return all available names.
 String getId()
          Return the unique id of this user.
 boolean isUserInRole(String role)
          Check if the user is in a given role.
 void removeAttribute(String key)
          Remove an information about the user.
 void setAttribute(String key, Object value)
          Set an information about the user.
 

Method Detail

getId

String getId()
Return the unique id of this user.

Returns:
The identifier.

setAttribute

void setAttribute(String key,
                  Object value)
Set an information about the user. For session replication the value of the attribute should be Serializable.

Parameters:
key - The key identifying the information.
value - The value of the information.

removeAttribute

void removeAttribute(String key)
Remove an information about the user.

Parameters:
key - The key identifying the information.

getAttribute

Object getAttribute(String key)
Get information about the user.

Parameters:
key - The key identifying the information.
Returns:
The value or null.

getAttributeNames

Iterator getAttributeNames()
Return all available names.

Returns:
An Iterator for the names (Strings).

isUserInRole

boolean isUserInRole(String role)
Check if the user is in a given role. This method can't check for a role handled by the servlet engine, it only handles indendently specified roles. Therefore, it is advisable to not call this method directly, but use the provided methods from the ApplicationUtil instead.

Parameters:
role - The role to test.
Returns:
Returns true if the user has the role, otherwise false.


Copyright © 1999-2010 The Apache Software Foundation. All Rights Reserved.