Expand my Community achievements bar.

SOLVED

Apache Sling Context-Aware Configuration

Avatar

Level 4

Hi,

I am using the apache sling context-aware configuration in AEM 6.3 Service pack 2. I am trying to get the configuration resource using below method

@Reference

private ConfigurationResourceResolver configurationResourceResolver;

confResource = configurationResourceResolver.getResource(resource, BUCKET_NAME, CONFIG_NAME);

This works fine in author and in publish when I am logged in to publish as admin. However this gives a null when i try to run as anonymous. Any idea if there is any configuration I am missing.

My bundle versions are as below

org.apache.sling.caconfig.api

Version 1.1.0

org.apache.sling.caconfig.impl

Version

1.4.12

org.apache.sling.caconfig.spi

Version 1.3.2

Is there a service user configuration that I can try out? I tried to provide a system user for org.apache.sling.caconfig.impl  but even that didn't work out.

1 Accepted Solution

Avatar

Correct answer by
Level 4

ConfMgr had the option to provide a serviceResourceResolver, but not with configurationResourceResolver. Giving read permissions to anonymous user for /conf directory solves the issue.

View solution in original post

2 Replies

Avatar

Correct answer by
Level 4

ConfMgr had the option to provide a serviceResourceResolver, but not with configurationResourceResolver. Giving read permissions to anonymous user for /conf directory solves the issue.