I have mapped the user info in portlet.xml too....but found the login name only
under the key "liferay.user.id"....try
String name = (String) userInfo.get("liferay.user.id");
But it hurts JSR 168
-----Ursprüngliche Nachricht-----
Von: Kevin Irmscher [mailto:[EMAIL PROTECTED]
Gesendet: Freitag, 4. Mai 2007 13:47
An: [email protected]
Betreff: Access portal user information in JSF Portlet application
Hi,
I have a JSF application in a Liferay Portal rendered as portlet using
MyFacesGenericPortlet class. I want to access user information that is
provided by the portal.
In a normal portlet application they can be accessed using
javax.portlet.RenderRequest.getAttribute(PortletRequest.USER_INFO);
in the render phase.
I tried it like that:
FacesContext fc = FacesContext.getCurrentInstance();
PortletRequest request = (PortletRequest) fc.getExternalContext().getRequest();
Map userInfo = (Map) request.getAttribute(PortletRequest.USER_INFO);
String name = (String) userInfo.get("user.name.given");
The map does not contain a user.name.given key so name is null.
Has anyone an idea how to solve that?
Regards, Kevin