mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-21 18:09:20 +00:00
ACE-3433 "Alfresco 5.0b mt cannot authenticate mobile users"
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@90269 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -36,6 +36,9 @@ import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.alfresco.opencmis.CMISDispatcherRegistry.Binding;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||
import org.alfresco.repo.tenant.TenantAdminService;
|
||||
import org.alfresco.repo.tenant.TenantService;
|
||||
import org.alfresco.repo.tenant.TenantUtil;
|
||||
import org.alfresco.repo.web.scripts.TenantWebScriptServletRequest;
|
||||
import org.alfresco.service.descriptor.Descriptor;
|
||||
@@ -63,7 +66,8 @@ public class CMISHttpServletRequest implements HttpServletRequest
|
||||
protected Binding binding;
|
||||
protected Descriptor currentDescriptor;
|
||||
|
||||
public CMISHttpServletRequest(WebScriptRequest req, String serviceName, BaseUrlGenerator baseUrlGenerator, Binding binding, Descriptor currentDescriptor)
|
||||
public CMISHttpServletRequest(WebScriptRequest req, String serviceName, BaseUrlGenerator baseUrlGenerator, Binding binding, Descriptor currentDescriptor,
|
||||
TenantAdminService tenantAdminService)
|
||||
{
|
||||
this.req = req;
|
||||
this.serviceName = serviceName;
|
||||
@@ -75,7 +79,25 @@ public class CMISHttpServletRequest implements HttpServletRequest
|
||||
if(!pathInfo.startsWith("/cmis") && (baseReq instanceof TenantWebScriptServletRequest))
|
||||
{
|
||||
TenantWebScriptServletRequest servletReq = (TenantWebScriptServletRequest)baseReq;
|
||||
this.networkId = servletReq.getTenant();
|
||||
|
||||
String tenant = servletReq.getTenant();
|
||||
if(tenant.equalsIgnoreCase(TenantUtil.DEFAULT_TENANT))
|
||||
{
|
||||
String user = AuthenticationUtil.getFullyAuthenticatedUser();
|
||||
String domain = tenantAdminService.getUserDomain(user);
|
||||
if(domain == null || domain.equals(TenantService.DEFAULT_DOMAIN))
|
||||
{
|
||||
this.networkId = tenant;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.networkId = domain;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.networkId = tenant;
|
||||
}
|
||||
}
|
||||
|
||||
Match match = req.getServiceMatch();
|
||||
|
@@ -39,6 +39,7 @@ import javax.servlet.http.HttpServletResponse;
|
||||
import org.alfresco.error.AlfrescoRuntimeException;
|
||||
import org.alfresco.opencmis.CMISDispatcherRegistry.Binding;
|
||||
import org.alfresco.opencmis.CMISDispatcherRegistry.Endpoint;
|
||||
import org.alfresco.repo.tenant.TenantAdminService;
|
||||
import org.alfresco.service.descriptor.Descriptor;
|
||||
import org.alfresco.service.descriptor.DescriptorService;
|
||||
import org.apache.chemistry.opencmis.commons.enums.CmisVersion;
|
||||
@@ -66,8 +67,14 @@ public abstract class CMISServletDispatcher implements CMISDispatcher
|
||||
protected BaseUrlGenerator baseUrlGenerator;
|
||||
protected String version;
|
||||
protected CmisVersion cmisVersion;
|
||||
|
||||
public void setDescriptorService(DescriptorService descriptorService)
|
||||
protected TenantAdminService tenantAdminService;
|
||||
|
||||
public void setTenantAdminService(TenantAdminService tenantAdminService)
|
||||
{
|
||||
this.tenantAdminService = tenantAdminService;
|
||||
}
|
||||
|
||||
public void setDescriptorService(DescriptorService descriptorService)
|
||||
{
|
||||
this.descriptorService = descriptorService;
|
||||
}
|
||||
@@ -164,7 +171,8 @@ public abstract class CMISServletDispatcher implements CMISDispatcher
|
||||
protected CMISHttpServletRequest getHttpRequest(WebScriptRequest req)
|
||||
{
|
||||
String serviceName = getServiceName();
|
||||
CMISHttpServletRequest httpReqWrapper = new CMISHttpServletRequest(req, serviceName, baseUrlGenerator, getBinding(), currentDescriptor);
|
||||
CMISHttpServletRequest httpReqWrapper = new CMISHttpServletRequest(req, serviceName, baseUrlGenerator,
|
||||
getBinding(), currentDescriptor, tenantAdminService);
|
||||
return httpReqWrapper;
|
||||
}
|
||||
|
||||
|
@@ -32,7 +32,8 @@ public class PublicApiAtomPubCMISDispatcher extends AtomPubCMISDispatcher
|
||||
protected CMISHttpServletRequest getHttpRequest(WebScriptRequest req)
|
||||
{
|
||||
String serviceName = getServiceName();
|
||||
CMISHttpServletRequest httpReqWrapper = new PublicApiCMISHttpServletRequest(req, serviceName, baseUrlGenerator, getBinding(), getCurrentDescriptor());
|
||||
CMISHttpServletRequest httpReqWrapper = new PublicApiCMISHttpServletRequest(req, serviceName, baseUrlGenerator,
|
||||
getBinding(), getCurrentDescriptor(), tenantAdminService);
|
||||
return httpReqWrapper;
|
||||
}
|
||||
}
|
@@ -14,7 +14,8 @@ public class PublicApiBrowserCMISDispatcher extends BrowserCMISDispatcher
|
||||
protected CMISHttpServletRequest getHttpRequest(WebScriptRequest req)
|
||||
{
|
||||
String serviceName = getServiceName();
|
||||
CMISHttpServletRequest httpReqWrapper = new PublicApiCMISHttpServletRequest(req, serviceName, baseUrlGenerator, getBinding(), getCurrentDescriptor());
|
||||
CMISHttpServletRequest httpReqWrapper = new PublicApiCMISHttpServletRequest(req, serviceName,
|
||||
baseUrlGenerator, getBinding(), getCurrentDescriptor(), tenantAdminService);
|
||||
return httpReqWrapper;
|
||||
}
|
||||
}
|
||||
|
@@ -21,6 +21,7 @@ package org.alfresco.opencmis;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.opencmis.CMISDispatcherRegistry.Binding;
|
||||
import org.alfresco.repo.tenant.TenantAdminService;
|
||||
import org.alfresco.service.descriptor.Descriptor;
|
||||
import org.springframework.extensions.webscripts.Match;
|
||||
import org.springframework.extensions.webscripts.WebScriptRequest;
|
||||
@@ -31,9 +32,9 @@ import org.springframework.extensions.webscripts.WebScriptRequest;
|
||||
public class PublicApiCMISHttpServletRequest extends CMISHttpServletRequest
|
||||
{
|
||||
public PublicApiCMISHttpServletRequest(WebScriptRequest req, String serviceName, BaseUrlGenerator baseUrlGenerator,
|
||||
Binding binding, Descriptor currentDescriptor)
|
||||
Binding binding, Descriptor currentDescriptor, TenantAdminService tenantAdminService)
|
||||
{
|
||||
super(req, serviceName, baseUrlGenerator, binding, currentDescriptor);
|
||||
super(req, serviceName, baseUrlGenerator, binding, currentDescriptor, tenantAdminService);
|
||||
}
|
||||
|
||||
protected void addAttributes()
|
||||
|
Reference in New Issue
Block a user