AEM 6.3 resourceresolver.adaptto(session.class) issue
I am trying to create session using resourceresolver and system user. I am able to get the session object but when I try to fetch the userid from session, it shows anonymous instead of system user used. Below is the code:
resolver = resourceResolverFactory.getResourceResolver(params);
session = resolver.adaptTo(Session.class);
String userId = session.getUserID(); // returns anonymous user instead of system user
This code is a part of OSGI servlet which invokes for specific paths.
Is there something wrong in the code or it is a bug?
