4.6.17 User object
The User object represents the authenticated user and is retrieved from the PortletRequest object. The API provides predicable getters and setters for the most common attributes of the user such as GivenName, FamilyName and UserID. This class provides access to both Basic and Extended attributes of the user. Basic attributes are those stored in the LDAP directory as part of the schema used throughout the portal. Extended attributes are those attributes stored in the Portal Server database. Example 4-15 illustrates accessing both basic and extended attributes.
Example 4-15 Working with User attributes
User user = request.getUser(); String familyName = user.getFamilyName(); String favoriteColor = user.getAttribute("favColor"); String phoneNumber = user.getAttribute("phoneNumber");
![]()
The getID returns as a String the complete DN of the user. For example, wpsadmin in a typical SecureWay® environment would return uid=wpsadmin, cn=users,dc=<domain>,dc>=<com> ``
There are two User interfaces defined in the Portlet API. The org.apache.jetspeed.portlet.User class represents the logged in user and is the User object you will use day-to-day. The com.ibm.wps.puma.beans.User interface is an EJB and is not used to access individual user information
ibm.com/redbooks