mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Support for Liferay user login in WebScript JSR-168 portlet authenticators.
Fix to add missing downloadUrl property to TemplateContentData object for non-standard content property values. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@6137 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -63,7 +63,13 @@ public class JSR168PortletAuthenticator implements WebScriptPortletAuthenticator
|
||||
*/
|
||||
public boolean authenticate(RequiredAuthentication required, boolean isGuest, RenderRequest req, RenderResponse res)
|
||||
{
|
||||
String portalUser = req.getRemoteUser();
|
||||
// first look for the username key in the session - we add this by hand for some portals
|
||||
// when the WebScriptPortletRequest is created
|
||||
String portalUser = (String)req.getPortletSession().getAttribute(WebScriptPortletRequest.ALFPORTLETUSERNAME);
|
||||
if (portalUser == null)
|
||||
{
|
||||
portalUser = req.getRemoteUser();
|
||||
}
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
|
@@ -76,10 +76,17 @@ public class WebClientPortletAuthenticator implements WebScriptPortletAuthentica
|
||||
public boolean authenticate(RequiredAuthentication required, boolean isGuest, RenderRequest req, RenderResponse res)
|
||||
{
|
||||
PortletSession session = req.getPortletSession();
|
||||
String portalUser = req.getRemoteUser();
|
||||
|
||||
// first look for the username key in the session - we add this by hand for some portals
|
||||
// when the WebScriptPortletRequest is created
|
||||
String portalUser = (String)req.getPortletSession().getAttribute(WebScriptPortletRequest.ALFPORTLETUSERNAME);
|
||||
if (portalUser == null)
|
||||
{
|
||||
portalUser = req.getRemoteUser();
|
||||
}
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
{
|
||||
logger.debug("JSR-168 Remote user: " + portalUser);
|
||||
}
|
||||
|
||||
|
@@ -24,6 +24,8 @@
|
||||
*/
|
||||
package org.alfresco.web.scripts.portlet;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import javax.portlet.PortletRequest;
|
||||
|
||||
import org.alfresco.web.scripts.WebScriptMatch;
|
||||
@@ -37,6 +39,8 @@ import org.alfresco.web.scripts.WebScriptURLRequest;
|
||||
*/
|
||||
public class WebScriptPortletRequest extends WebScriptURLRequest
|
||||
{
|
||||
public static final String ALFPORTLETUSERNAME = "alfportletusername";
|
||||
|
||||
/** Portlet Request */
|
||||
private PortletRequest req;
|
||||
|
||||
@@ -64,6 +68,23 @@ public class WebScriptPortletRequest extends WebScriptURLRequest
|
||||
{
|
||||
super(scriptUrlParts, serviceMatch);
|
||||
this.req = req;
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -92,5 +113,4 @@ public class WebScriptPortletRequest extends WebScriptURLRequest
|
||||
// NOTE: rely on default agent mappings
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user