mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
REPO-4859 : HTTP_UNAUTHORIZED instead of HTTP_FORBIDDEN for some CMIS apis (#932)
- updated code so the Context set includes the USERNAME field. - the missing of that field on the context was causing the CMIS lib to trigger a 401
This commit is contained in:
@@ -44,8 +44,6 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
import net.sf.acegisecurity.Authentication;
|
|
||||||
|
|
||||||
import org.alfresco.model.ContentModel;
|
import org.alfresco.model.ContentModel;
|
||||||
import org.alfresco.opencmis.dictionary.CMISNodeInfo;
|
import org.alfresco.opencmis.dictionary.CMISNodeInfo;
|
||||||
import org.alfresco.opencmis.dictionary.CMISObjectVariant;
|
import org.alfresco.opencmis.dictionary.CMISObjectVariant;
|
||||||
@@ -136,6 +134,7 @@ import org.apache.chemistry.opencmis.commons.impl.server.AbstractCmisService;
|
|||||||
import org.apache.chemistry.opencmis.commons.impl.server.ObjectInfoImpl;
|
import org.apache.chemistry.opencmis.commons.impl.server.ObjectInfoImpl;
|
||||||
import org.apache.chemistry.opencmis.commons.impl.server.RenditionInfoImpl;
|
import org.apache.chemistry.opencmis.commons.impl.server.RenditionInfoImpl;
|
||||||
import org.apache.chemistry.opencmis.commons.server.CallContext;
|
import org.apache.chemistry.opencmis.commons.server.CallContext;
|
||||||
|
import org.apache.chemistry.opencmis.commons.server.MutableCallContext;
|
||||||
import org.apache.chemistry.opencmis.commons.server.ObjectInfo;
|
import org.apache.chemistry.opencmis.commons.server.ObjectInfo;
|
||||||
import org.apache.chemistry.opencmis.commons.server.RenditionInfo;
|
import org.apache.chemistry.opencmis.commons.server.RenditionInfo;
|
||||||
import org.apache.chemistry.opencmis.commons.spi.Holder;
|
import org.apache.chemistry.opencmis.commons.spi.Holder;
|
||||||
@@ -143,6 +142,8 @@ import org.apache.chemistry.opencmis.server.shared.QueryStringHttpServletRequest
|
|||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
|
||||||
|
import net.sf.acegisecurity.Authentication;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* OpenCMIS service implementation
|
* OpenCMIS service implementation
|
||||||
*
|
*
|
||||||
@@ -176,7 +177,19 @@ public class AlfrescoCmisServiceImpl extends AbstractCmisService implements Alfr
|
|||||||
@Override
|
@Override
|
||||||
public void open(CallContext context)
|
public void open(CallContext context)
|
||||||
{
|
{
|
||||||
AlfrescoCmisServiceCall.set(context);
|
if (context instanceof MutableCallContext)
|
||||||
|
{
|
||||||
|
MutableCallContext mutableCallContext = (MutableCallContext) context;
|
||||||
|
if (mutableCallContext.getUsername() == null && AuthenticationUtil.getFullyAuthenticatedUser() != null)
|
||||||
|
{
|
||||||
|
mutableCallContext.put(CallContext.USERNAME, AuthenticationUtil.getFullyAuthenticatedUser());
|
||||||
|
}
|
||||||
|
AlfrescoCmisServiceCall.set(mutableCallContext);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
AlfrescoCmisServiceCall.set(context);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected CallContext getContext()
|
protected CallContext getContext()
|
||||||
|
Reference in New Issue
Block a user