AnsweredAssumed Answered

How to authenticate contentService in workflow

Question asked by pnature on Feb 10, 2017
Latest reply on Feb 14, 2017 by pnature

Hi

I am new on Alfresco. I am using community version 5.2 

In my workflow I have service task with java class. There I get Alfresco service registry

 

             // Get services
            Map<Object, Object> registeredBeans = Context.getProcessEngineConfiguration().getBeans();
            ServiceRegistry registry = (ServiceRegistry)registeredBeans.get(ActivitiConstants.SERVICE_REGISTRY_BEAN_KEY);
            ContentService contentService = registry.getContentService();

 

I want to use content service to read content of document associated with workflow

 

// Get Document
ActivitiScriptNode scriptNode = (ActivitiScriptNode) execution.getVariable("docnode");
docref = new NodeRef("workspace://SpacesStore/18fb353f-d525-4dbc-98ec-d91a3faccbe0"); //test with fixed existing file in repo
ContentReader reader = contentService.getReader(docref, ContentModel.PROP_CONTENT);
originalInputStream = reader.getContentInputStream();
filename = scriptNode.getName();

 

Unfortunately contentService.getReader ends up with excetion

Caused by: net.sf.acegisecurity.providers.ProviderNotFoundException: No authentication provider for net.sf.acegisecurity.providers.UsernamePasswordAuthenticationToken

 

Help me plesase how to get rid of it.

Thank you in advance.

Outcomes