(replying to
wcm.io mailing list)
if the configuration is stored at /conf you need to set the required permisson for the "everyone" principal on publish.
that means "jcr:read" permissions. not necessarily for everything below /conf, but at least for the nodes where your configuration is stored.
adobe is doing the same when using editable templates, part of the template editor definitions stored below /conf needs to be accessible for the anonymous user as well - examples: [1][2][3].
this is a bit complicated to setup, especially because the AEM GUI (including AEM 6.3) does not provide any support for this. an alternative is not to store the configuration below /conf and use the "Tools Config Page" strategy instead. then the config data is stored as part of the content in a /tools/config page. of course you have to make sure no sensitive data is stored there.
stefan
[1]
https://github.com/Adobe-Marketing-Cloud/aem-sample-we-retail/blob/master/ui.content/src/main/content/jcr_root/conf/we-retail/settings/wcm/policies/_rep_policy.xml
[2]
https://github.com/Adobe-Marketing-Cloud/aem-sample-we-retail/blob/master/ui.content/src/main/content/jcr_root/conf/we-retail/settings/wcm/template-types/_rep_policy.xml
[3]
https://github.com/Adobe-Marketing-Cloud/aem-sample-we-retail/blob/master/ui.content/src/main/content/jcr_root/conf/we-retail/settings/wcm/templates/_rep_policy.xml
[4]
http://wcm.io/caconfig/extensions/persistence-strategies.html
>-----Original Message-----
>From: Kuijpers, Henry [mailto:
Henry.K...@amplexor.com]
>Sent: Thursday, July 27, 2017 1:54 PM
>To: Stefan Seifert
>Subject: Context Aware Configuration - Any idea?
>
>Hi Stefan,
>
>Excuse me for e-mailing you this way, but I'm kind of hurting my head here.
>:)
>
>I'm using the ResourceResolver that's on the request to get an instance of
>a Configuration-annotated class:
>
> final ConfigurationBuilder builder =
>resource.adaptTo(ConfigurationBuilder.class);
> if (builder != null) {
> return
builder.as((Class<?>) declaredType);
> }
>
>This is of course working fine as admin, but when testing on the Publish-
>environment (anonymous), it is failing to find the configuration. I was
>debugging a bit through the code and saw that all .getResource() calls are
>returning null for the /conf path. Which is intended of course, since they
>should not be accessible by anonymous users.
>
>What would you recommend doing here? Everytime I want to create a
>ConfigurationBuilder, use a separate resourceresolver, with elevated access
>to the /conf node?
>Or is it supposed to just work with the anonymous one, and should I
>configure some permissions on /conf?
>
>I did see that you are using a ServiceResourceResolver specifically in the
>ConfigurationWebConsolePlugin:
> private ResourceResolver getResolver() {
> try {
> return resolverFactory.getServiceResourceResolver(null);
> }
> catch (final LoginException ex) {
> log.warn("Unable to get resource resolver - please ensure a
>system user is configured: {}", ex.getMessage());
> return null;
> }
> }
>
>Looking for some pointers here. :) Or maybe a place to ask this question,
>instead of through e-mail.
>
>Thank you very much!
>
>Henry