General support for user attributes
You need to add to your portlet.xml something like
...
Code Block |
---|
| java |
---|
| java |
---|
title | Accessing a user attribute from JSR-168 Java implementation |
---|
|
Map userInfo = (Map)request.getAttribute(PortletRequest.USER_INFO);
String surname = (String)userInfo.get("user.name.family");
|
Special support for conveying the end user's password to the JSR-168 portlet
Note |
---|
title | Cache and replay passwords only with sober consideration |
---|
|
Don't use uPortal's password caching and replay features unless you really want these behaviors! Don't expose end user passwords to portlets you don't trust. (Then again, don't install into your portal portlets you don't trust.) |
The user attribute "password" is populated with the end user's cached password when a caching security context is used.
Code Block |
---|
| xml |
---|
| xml |
---|
title | Declaring password user attribute in portlet.xml |
---|
|
<user-attribute>
<description>Specially treated user attribute name that will be populated with the end user's cached password, if available</description>
<name>password</name>
</user-attribute>
|
Then from within your Portlet code you can access the password like this
Code Block |
---|
| java |
---|
| java |
---|
title | Accessing a user attribute from JSR-168 Java implementation |
---|
|
Map userInfo = (Map)request.getAttribute(PortletRequest.USER_INFO);
String password = (String)userInfo.get("password");
|