AI have a problem with accessing resources from within my Runnable class.
I am implementing the Runnable component in AEM (v.6.5). It needs to access the resource, in this case, it is '/libs/wcm/core/resources/languages'. However, this resource is not accessible for anonymous user and AEM starts my component with such user.
How I can change the user inside my Runnable class so it is run with different permissions?
Thanks in advance for help.
org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl.my-service-user.xml :
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
jcr:primaryType="sling:OsgiConfig"
user.mapping="[xxx.yyy.my-app.core:my-service=[my-service-system-user]]"/>
Getting the Reosurce:
resourceResolver = resolverFactory.getServiceResourceResolver(Collections.singletonMap(ResourceResolverFactory.SUBSERVICE, "my-service"));
I read some documentation but it is just not working in my case.
I am at the very beginning of my AEM 'adventure' so maybe I just understand something :)
As I understand, I need a 'system user'. I don't want to be dependent on 'acs-aem-commons'. I was trying this blog article. I created the user manually, then created the config file and remove user from the system. It is not being recreated.