There's a code like this in my project to read some configuration from /etc/my-config-path:
Resource res = resource.getResourceResolver().getResource("/etc/my-config-path");
On AEM 5.6.1 it works correctly since anonymous user has access to entire /etc. On AEM 6.1 res is null since anonymous user has no access to /etc.
I can see two possible solutions:
- Give anonymous user read permission to /etc/my-config-path explicitly
- Use
repository.loginAdministrative(null);
to access the resource with admin permissions (but I see some people not recommending this approach on AEM 6.1).
What is your thoughts on this?