Search code examples
adobeaemsling

AEM 6.1 anonymous read access to /etc was removed. How to handle this?


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:

  1. Give anonymous user read permission to /etc/my-config-path explicitly
  2. 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?


Solution

  • In AEM 6.1 access to /etc by default to admin was removed. I posted a solution here, describes how to create a service user.