11-29-2007 10:00 AM
01-02-2008 12:00 PM
01-03-2008 09:54 AM
I'm not sure how the CAS single-sign-on filter works, but I think the code will need to be changed to pickup the username from the new field in liferay. For our portlets we had to change to authenticator to get the username from the user.home-info.online.email field from the PortletRequest.USER_INFO object and strip off the @address part - pretty poor but we couldn't find another way to do it without using Liferay specific classes…
Thanks,
Kevin
01-03-2008 10:11 AM
<user-attribute>
<name>user.home-info.online.email</name>
</user-attribute>
// look for the user info map in the portlet request - populated by the portlet container
Map userInfo = (Map)req.getAttribute(PortletRequest.USER_INFO);
if (userInfo != null)
{
// look for the special Liferay email (username) key
String liferayUsername = (String)userInfo.get("user.home-info.online.email");
if (liferayUsername != null)
{
// strip suffix from email address - we only need username part
if (liferayUsername.indexOf('@') != -1)
{
liferayUsername = liferayUsername.substring(0, liferayUsername.indexOf('@'));
}
// save in session for use by alfresco portlet authenticator
this.req.getPortletSession().setAttribute(ALFPORTLETUSERNAME, liferayUsername);
}
}
Basically we strip the first part of the email address of the user and use that later as the username for the Alfresco authentication. If that value is not found in the session, then we get the username as we did before via the call to getRemoteUser() on the PortletRequest. It's a bit cheesy yes but it means we have a solution for both Liferay and JBoss etc.01-03-2008 10:44 AM
And then look for that value (set by Liferay as part of the JSR-168 Portal spec contract) when processing the portlet request:
// look for the user info map in the portlet request - populated by the portlet container
Map userInfo = (Map)req.getAttribute(PortletRequest.USER_INFO);
if (userInfo != null)
{
// look for the special Liferay email (username) key
String liferayUsername = (String)userInfo.get("user.home-info.online.email");
if (liferayUsername != null)
{
// strip suffix from email address - we only need username part
if (liferayUsername.indexOf('@') != -1)
{
liferayUsername = liferayUsername.substring(0, liferayUsername.indexOf('@'));
}
// save in session for use by alfresco portlet authenticator
this.req.getPortletSession().setAttribute(ALFPORTLETUSERNAME, liferayUsername);
}
}
01-05-2008 10:59 AM
02-05-2008 12:58 PM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.