Here is the piece of code to impersonate the session:
@Reference
SlingRepository repo;
Session adminSession = repo.loginAdministrative(null);
Session userSession = adminSession.impersonate (new SimpleCredentials("<userId>",new char[0]));
log.debug(“Session is: {}”, userSession.getUserID());
No comments:
Post a Comment